0

I want to print the if statement by inputting 5, but unfortunately print the else statement, help me to print the if statement.

m = input() if m == round(4.9): print("m is rounded or approximated and equal to 5") else: print("m is rounded or approximated and not equal to 5")

22nd Jan 2021, 6:02 PM
Muhammad Abdulmalik
Muhammad Abdulmalik - avatar
3 odpowiedzi
+ 3
By default the return type of input() function is a string, so you need to cast the input value to integer if you are going to compare it with other integer. m=int(input())
22nd Jan 2021, 6:06 PM
Abhay
Abhay - avatar
+ 1
Use m=int(input())
22nd Jan 2021, 6:43 PM
Hisham YUM 🇲🇦
Hisham YUM 🇲🇦 - avatar
0
Use m=int(input()) Cause by default it is a string so then comparing it to a float Oh no
23rd Jan 2021, 10:27 AM
Ozemoka Shuaib Aloaye
Ozemoka Shuaib Aloaye - avatar