Not working. Help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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)

5th May 2020, 6:30 PM
Christian Sandoval
Christian Sandoval - avatar
3 Answers
+ 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 =
5th May 2020, 6:53 PM
M Tamim
M Tamim - avatar
+ 2
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 But systolic and diastolic are strings and (230) and (50) are integers probably, not?
5th May 2020, 6:54 PM
M Tamim
M Tamim - avatar
5th May 2020, 7:03 PM
M Tamim
M Tamim - avatar