二手产品经理

二手产品经理

THIS IS RENO

Learn Python in 100 Days Online - Week 2 Day 6

Record

  1. Today is a comprehensive practice, calculating grade rankings and score percentages. Grade rankings are easy to understand, but I have never encountered score percentages before.
  2. This should be related to ranking based on the sum of scores, which I have been familiar with since childhood, and I have never encountered rankings like ABCD. I thought about this for a while and couldn't figure it out, so I finally asked CHATGPT.
  3. This practice involved the logical relationship between If and elif, the use of indentation, and the definition of numbers in calculations, paying attention to int and float.

CODE#

print("Exam Grade Ranking Query")
exam = input("Enter the exam subject you want to query? ")
maxscore = int(input("Enter the full score for the subject: "))
score = int(input("Enter your exam score: "))
number = round((score / maxscore * 100), 2)
print("You will query the grade ranking for", exam, "and your ranking:")

if number <= 100 and number >= 90:
    print("🎉 Your grade ranking: A+.")
elif number < 89 and number > 80:
    print("🏵 Your grade ranking: A+.")
elif number < 79 and number > 70:
    print("🌈 Your grade ranking: B.")
elif number < 69 and number > 60:
    print("🤪 Your grade ranking: C.")
elif number < 59 and number > 50:
    print("🥲 Your grade ranking: D.")
else:
    print("😴 Your grade ranking: U.")
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.