Issue
code is supposed to add up and give a star ranking to the user based on thier answers to the prompts i.e first year taking 13 credits, no roommate, no clubs, and has not been in trouble with the law should print 2.5 stars
score = 0
print("Housing Priority Calculator")
print()
print("QUESTION 1")
year = input(" What year are you going into (1, 2, 3, 4): ")
if year == "1":
score += 0.5
if year == "2":
score += 0.5
elif year == "3":
score += 1
elif year == "4":
score += 1
print("Question 2")
credit = input(" How many credits are you taking: ")
if credit < "12":
score += 0.5
elif credit >= "12":
score += 1
print("Question 3")
mate = input("Are you in need of a roommate? (Y/N): ")
if mate == "Y" or "y":
score += 1
elif mate == "N" or "n":
score += 0
print("QUESTION 4")
extra = input("are you in any school sponsored extra curricular i.e. sports or clubs? (Y/N)")
if extra == "Y" or "y":
score += 1
elif extra == "N" or "n":
score += 0
print("Question 5")
conduct = input("Have you ever been in trouble with the law or school? (Y/N)")
if conduct == "Y" or "y":
score -1
if conduct == "N" or "n":
score += 1
print("Your housing priority score is",score,"stars out of 5 stars")
#code is supposed to add up and give a star ranking to the user based on thier answers to the prompts
Solution
in question 2 you're comparing strings. do this instead
if int(credit) < 12:
score += 0.5
elif int(credit) >= 12:
score += 1
Answered By - 9EED
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.