Hello Guys I am new to the python, I am learning the basic & during my practice i found one Issue
(OverflowError: cannot fit 'int' into an index-sized integer)
Below are my Code
# Ask user their details & Age Information
userName = input("What is your name? ")
userAge = input("What is your age? ")
userAgeInt = int(userAge)
print ("Hello there" userName)
userAgeTenTime = (userAge * 10)
userAgeTenTimeInt = int(userAgeTenTime)
print ("Your Age ten times is" * userAgeTenTimeInt )
if(userAgeInt >= 18):
print('You are old enough to vote')
else:
print('You are not old enough to vote')
CodePudding user response:
Your issue is with these 3 lines:
userAgeTenTime = (userAge * 10)
userAgeTenTimeInt = int(userAgeTenTime)
print ("Your Age ten times is" * userAgeTenTimeInt )
Here, you take the userAge
string, let's say "123"
and repeat it 10 times - "123123123123123123123123123123"
Then you convert it into an integer (123123123123123123123123123123
).
Then you try to repeat the string "Your Age ten times is"
, 123123123123123123123123123123 times.
I believe your intention was:
userAgeTenTime = (userAgeInt * 10)
print ("Your Age ten times is", userAgeTenTime)