Skip to content

Commit fc6544b

Browse files
committed
python 1 changes
1 parent c1a27ee commit fc6544b

36 files changed

+5575
-2309
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Create Allergy check code
2+
3+
# [ ] get input for input_test variable
4+
input_test = input("What have you eaten in the last 24hrs: ")
5+
6+
# [ ] print "True" message if "dairy" is in the input or False message if not
7+
print("Your food intake of",input_test,'contains "dairy" =',"dairy".lower() in input_test.lower())
8+
#test works
9+
# [ ] print True message if "nuts" is in the input or False if not
10+
print("Your food intake of",input_test,'contains "Nuts" =',"Nuts".lower() in input_test.lower())
11+
12+
# [ ] Challenge: Check if "seafood" is in the input - print message
13+
print("Your food intake of",input_test,'contains "seafood" =',"seafood".lower() in input_test.lower())
14+
15+
# [ ] Challenge: Check if "chocolate" is in the input - print message
16+
print("Your food intake of",input_test,'contains "chocolate" =',"chocolate".lower() in input_test.lower())

2 ksu scrape/ksu_scrape.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'''
2-
TO use this code, you will first need to install the three packages being imported below using pip or a manual install method.
32
To use this code, you will first need to install the three packages being imported below using pip or a manual install method.
43
'''
54
from bs4 import BeautifulSoup

P1M2kristymusgrove.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def fishstore(fish,price):
2+
fishstore_statement="The price for " + fish + " is $" + price +"."
3+
return fishstore_statement
4+
#fish_entry="1"
5+
#price_entry="2"
6+
fish_entry=input("Fish Type: ")
7+
price_entry=input("Fish Price: ")
8+
9+
print(fishstore(fish_entry,price_entry))

P1M3kristymusgrove.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
maximum_order=10
2+
minimum_order=2
3+
price=2
4+
order_amount=input("Enter Order Amount: ")
5+
if int(order_amount)>maximum_order:
6+
print("Order Maximum is", maximum_order)
7+
elif int(order_amount)<minimum_order:
8+
print("Order Minimum is",minimum_order)
9+
else:
10+
print(int(order_amount)*price)

P1M5kristymusgrove.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#This program calls the adding_report() function which repeatedly takes positive integer input until the user quits and then sums the integers and prints a "report".
2+
3+
#"A" used as the argument to adding_report() results in printing of all of the input integers and the total
4+
#"T" used as the argument results in printing only the total
5+
6+
print("Add an 'A' to see the input list and total or a 'T' to see just the total.")
7+
#checks for A or T
8+
while True:
9+
report_type = input("A/T: ").upper()
10+
if report_type not in ("A,T"):
11+
print("Invalid Entry")
12+
else:
13+
break
14+
15+
#The adding_report() function has 1 string parameter which indicates the type of report:
16+
def adding_report(report):
17+
#initialize total variable which will sum integer values entered
18+
#initialize items variable which will build a string of the integer inputs separated with a new line character
19+
items = ""
20+
total=0
21+
add_integer = ""
22+
#inside the function build a forever loop (infinite while loop) and inside the loop complete the following
23+
while True:
24+
#use a variable to gather input (integer or "Q")
25+
add_integer = input("Enter an integer of 'Q' to quit: ").upper()
26+
if add_integer.isdigit():
27+
#check if the input string is a digit (integer) and if it is...
28+
items += '\n' + add_integer #if report type is "A" add the numeric character(s) to the item string seperated by a new lin
29+
#add input iteger to total
30+
total += int(add_integer)
31+
elif add_integer.upper() == "Q":#if not a digit, check if the input string is "Q"
32+
#if the report type is "A" print out all the integer items entered and the sum total
33+
if report_type.upper() == "A":
34+
print()
35+
print("items:",items)
36+
break
37+
#if report type is "T" then print out the sum total only
38+
elif report_type.upper() == "T":
39+
break
40+
#if not a digit and if not a "Q" then print a message that the "input is invalid"
41+
else:
42+
print("Invalid Entry")
43+
print()
44+
print("total:")
45+
return total
46+
print(adding_report(report_type))

Python Absolute Beginner/Module_1_1.1_Absolute_Beginner_START_HERE.ipynb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,24 @@
267267
"outputs": [],
268268
"source": []
269269
},
270+
{
271+
"cell_type": "code",
272+
"execution_count": 1,
273+
"metadata": {},
274+
"outputs": [
275+
{
276+
"name": "stdout",
277+
"output_type": "stream",
278+
"text": [
279+
"after edit, save!\n"
280+
]
281+
}
282+
],
283+
"source": [
284+
"# Inserted new cell below\n",
285+
"print(\"after edit, save!\")"
286+
]
287+
},
270288
{
271289
"cell_type": "markdown",
272290
"metadata": {},
@@ -284,6 +302,23 @@
284302
"outputs": [],
285303
"source": []
286304
},
305+
{
306+
"cell_type": "code",
307+
"execution_count": 2,
308+
"metadata": {},
309+
"outputs": [
310+
{
311+
"name": "stdout",
312+
"output_type": "stream",
313+
"text": [
314+
"Keybord shortcut to sace is CTL+s\n"
315+
]
316+
}
317+
],
318+
"source": [
319+
"print(\"Keybord shortcut to sace is CTL+s\")"
320+
]
321+
},
287322
{
288323
"cell_type": "code",
289324
"execution_count": null,

0 commit comments

Comments
 (0)