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
5 RĂ©ponses
+ 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