This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Exercise 1 Test After Columns are entered, then with ORDER BY clause entered | |
SELECT ProductCode | |
, ProductName | |
, ListPrice | |
, DiscountPercent | |
FROM Products | |
ORDER BY ListPrice DESC; | |
--Exercise 2 Ascending order M-Z last names with combined name = Full name | |
SELECT LastName + ', ' + FirstName AS [Full Name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Exercise 1 | |
SELECT VendorContactLName AS [Last Name] | |
, VendorContactFName AS [First Name] | |
, VendorName AS [Vendor] | |
FROM Vendors | |
ORDER BY VendorContactLName | |
, VendorContactFName; --Learned to use column numbers as ORDER BY's, | |
--but not recommended & Semi-Colon use will be | |
--required in future SQL Server editions so to | |
--get used to ending each statement with one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--AM CP 150 9/27 Ch 3 | |
/* | |
This is a Multi-Line | |
Comment | |
*/ | |
--SELECT * | |
--Grabs all columns | |
--from vendors tab | |
--Semi-Colon to show end of queries, not necessary in T-SQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ch_2_jrn_4 | |
#Exercise 14 | |
#This program calculates | |
#Compound Interest | |
print(' ') | |
print('Calculate compound interest by inputting values.') | |
print(' ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Write a Python program to convert a number of hot dogs to a number of | |
#packs of hot dogs and a number of packs of buns. You can assume that hot | |
#dogs come 10 to a pack and that buns come 8 to a pack. Prompt the user to | |
#enter a number of hotdogs, then compute and print the number of packages | |
#of hot dogs and buns that are needed to ensure you have enough hot dogs | |
#and buns,For example, if you need to serve 75 hot dogs and buns, you will | |
#need 8 packages of hot dogs and 10 packages of buns. To get the calculation | |
#of packages to come out to an integer, use math.ceil. For example, | |
#math.ceil(1.23)will give the value 2 as an integer. So if you need num_dogs, | |
#( say, 75)hot dogs and buns, that is math.ceil(num_dogs /10), i.e. 8, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To round a number when printing, we use the format function. Write the | |
#following code, run it to see what it prints. Then change the ‘.2f’ to | |
#‘.3f’ and see how that affects the results. | |
amount_due = 5000.0 | |
payment = amount_due / 12 | |
print('payment is', format(payment, '.2f')) | |
amount_due = 5000.0 | |
payment = amount_due / 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this program asks the user for | |
# personal data and then prints | |
# it on the screen | |
name = input('Name: ') | |
city = input('City: ') | |
state = input('State: ') | |
zipcode = input('ZIP Code: ') | |
telephone_number = input('Telephone: ') | |
email_address = input('E-Mail: ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this program will compute | |
# the average of three values | |
# input by the user. | |
x = float(input('Number: ')) | |
y = float(input('Number: ')) | |
z = float(input('Number: ')) | |
average = (x + y + z) / 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tip, Tax Food Calculator | |
# First Flowchart problem homework 1 | |
# We will use 18% as the tip rate | |
TIP_PERCENTAGE = 0.18 | |
# Currently the tax rate is 9% | |
TAX_PERCENTAGE = 0.09 | |
charge_for_food = float(input('Input charge for food: ')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Asks for user's last name. | |
name = input('Last name: ') | |
print('Last name is:', name) |