Reputation: 169
I have this really frustrating error that I can't seem to fix, it tells me that the "<" is not supported by strings and integers but I made sure I converted them into integers using the int() function
import random
print("Hi what is your name?")
name = input()
print("And your age please?")
age = input()
print(f"Now {name} pick a number that is lower than your age ({age}) but bigger than zero")
number_pick = input()
if number_pick != "":
int(age)
int(number_pick)
if number_pick > 0:
print(f"Good choice now the result of your {age} timesed by {number_pick} is..")
print(age * number_pick)
else:
print("your number doesnt follow the requirements")
else:
print("Please write your number pick")
I am lost for ideas, what should I change?
Upvotes: 1
Views: 296
Reputation: 3301
int(number_pick)
This cast returns the result of the conversion, but you aren't storing it anywhere.
number_pick = int(number_pick)
You may also want to add some error checking:
try:
number_pick = int(number_pick)
except TypeError:
print("Please make sure you are entering in a number")
Upvotes: 7