HOMEWORK:
Part 1:
Use if-elif-else statements to create a grading system where a user inputs a percent grade (0 to 100).
if 100-90 = A
else if 89-80 = B
and so on
Part 2:
Use a while loop to print a pattern starting from 1 and ending at 46 where the difference between terms increases by 1:
1, 2, 4, 7, 11, 16, 22, 29, 37, 47
Hint: You will need 2 different variables. One of them will be the number you print and the other will be the amount you add.
RESOURCES:
Class slides: https://docs.google.com/presentation/d/1UlxFWDgPrOBy-5pybRom5_nRyehCyvPIN2n3mc3Sgkw/edit?usp=sharing
Example code: https://replit.com/@ShravyaS/IntroToPython-Wk2Day1
Coding platform: replit.com
LOL Discord: https://discord.gg/dWVUBmPx
Post your answers as a comment! I will post the solution before next class.
You can always email us at shravyassathish@gmail.com (mentor) or kingericwu@gmail.com (TA) or message us on Discord if you have any questions about the homework or what we covered in class.
grade = int(input("Did you pass your most recent test? Enter your score here: "))
if grade >= 90:
print("A: You are sooo smart!")
elif grade >= 80:
print("B: You're getting there!")
elif grade >= 70:
print("C: Nice try!")
elif grade >= 60:
print("D: There's always next time!")
else:
print("F: Ummm... You know what? Just forget it. I'm running out of positives, let's make this quick. You've graduated school!!!")
x = 1
y = 0
while y <= 10:
print(x)
y += 1
x += y
I finally figured out how to do this pattern
It's a little late, but at least I did it
if score>=90:
grade="A"
elif score >=80:
grade = "B"
elif score >=70:
grade = "C"
elif score >=60:
grade = "D"
else:
grade = "F"
print(f'Your grade is {grade}') ------------------------------- i=1
j=1
while i<=47:
print(i, end=' ')
i+=j
j+=1
grade = float(input("grade percentage"))
if 97<=grade<=100:
print("A+")
elif 94<=grade<=96:
print("A")
elif 90<=grade<=93:
print("A-")
elif 87<=grade<=89:
print("B+")
elif 84<=grade<=86:
print("B")
elif 80<=grade<=83:
print("B-")
elif 77<=grade<=79:
print("C+")
elif 74<=grade<=76:
print("C")
elif 70<=grade<=73:
print("C-")
elif 67<=grade<=69:
print("D+")
elif 64<=grade<=66:
print("D")
elif 60<=grade<=63:
print("D-")
else: print("F")
grade = input ("what is the grade percentage? ")
grade = int(grade)
if 90 <= grade <= 100 :
print("A")
elif 80 <= grade <= 89 :
print("B")
elif 70 <= grade <= 79 :
print("C")
elif 60 <= grade <= 69 :
print("D")
else:
print("F")
x=1
i =1
while i <= 10:
print(x)
x = x+i
i = i+1
#Part 1:
grade = float(input("Input a percent grade from 0 to 100 and this program will output the equivalent letter grade.: "))
if 90<=grade>=100:
print("A")
elif 80<=grade>=89:
print("B")
elif 70<=grade>=79:
print("C")
elif 60<=grade>=69:
print("D")
else:
print("F")
#Part 2:
num = 1
addNum = 1
while addNum <= 10:
print(num)
num+=addNum
addNum+=1