0
Not working. Help!
systolic = input("Enter systolic value: ") diastolic = input("Enter diastolic value: ") if systolic = (230): print("Invalid number") break elif diastolic = (50): print("Invalid number: ") else: print("Systolic: " + systolic) print("Diastolic: " + diastolic)
3 ответов
+ 2
It can be done more easily. -->
systolic = int(input("Enter systolic pressure: "))
diastolic = int(input("Enter diastolic pressure: "))
if systolic >= 230 or diastolic <= 50:
print("Hello, mr. ghost!")
else:
print("systolic :", systolic)
print("diastolic :", diastolic)
Note :
you cannot compare str type (e.g. systolic) to int type (230).
== is the comparison operator not =
+ 2
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥
But systolic and diastolic are strings and (230) and (50) are integers probably, not?
+ 2
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥
That's right now.