invalid literal for int() with base 10?

+1 vote
asked Oct 2 by (150 points)
No errors when entering rounded figures for (rate), but when running the below with rate of 35.25, the error message come up (invalid literal for int() with base 10)


rate = input("Please Enter the Desired Rate ")
if int(rate) > 50:
    print("The Rate is High")
elif int(rate) < 50:
    print("The Rate is Low")
    print("Exactly 50")


3 Answers

0 votes
answered Oct 3 by anonymous
use double . always use double for currency .
+1 vote
answered Oct 5 by anonymous
This error because python is expecting an integer value ie. in simple number without any decimal,

the solution is that you could use float(input()) instead of int(input().
0 votes
answered 6 days ago by anonymous
Expecting an int.

Either typecast or use a float, double, real
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.