Feb-07-2020, 05:13 PM
Hello Everyone,
I am new to programming and new to python. I tried to run below program and it gave me the first value i entered. After first value if I press enter it gave me second value and so on and it didn't exit the program. Please help me out with errors.
I am new to programming and new to python. I tried to run below program and it gave me the first value i entered. After first value if I press enter it gave me second value and so on and it didn't exit the program. Please help me out with errors.
userdata = [
"Enter your first name: ",
"Enter your middle name: ",
"Enter your last name: ",
"Enter your age: ",
"Enter your mobile number: ",
"Enter your street name: ",
"Enter your city name: ",
"Enter your state name: ",
"Enter your postal code: ",
"Enter your country name: "
]
counter = 0
for i in userdata:
if userdata[counter] == 3 or userdata[counter] == 4:
userdata.append(int(input(i)))
else:
userdata.append(input(i))
counter += 1
if userdata[3] < 20:
print('According to your age, You are young')
else:
print('According to your age, You are not young')
print("Hello", userdata[0],userdata[1],userdata[2], "You are",userdata[3], "years old.", "After 10 years your age will be", userdata[3]+10,"years old.")
print("Your mobile number is", userdata[4],sep=': ')
print("You live in:",userdata[5],userdata[6],userdata[7],userdata[8],userdata[9],end='.')
