+ 1
HELP! HOW I CAN MAKE IT?
I'd like to make an input checker. For example: if input = 1 or 2 or 3 or 4 or 5: set, for example, money to: Money = input * 10 I need to make: Money will be x10 from input. Example: If input = 4 Money = 40 How I can make it? I don't know why, but every time it sends: ——————— Money = input * 10 TypeError: unsupported operand type(s) for *: 'builtin_function_method' and ' int'
12 Réponses
+ 10
money = int(input("enter a number"))
if money >0 && money <6 :
money *=10
+ 2
Here resone is when we take input it is in the form of string.
if you try to multiply string with int it is incompatible.
As you got the answer by converting you values all in string, you can also try to convert your input in integer.It will work.
+ 1
n = int(input())
money = n*10 if 0<n<6 else None
if not money:
print('Incorrect input.')
0
MY GOD, THANK YOU SO MUCH!
0
uw
0
برو بمیر
0
😎
0
type casting in p*
0
your program must be simple it must be
money=int(input('enter a digit between 1and5'))
if 0<money<6:
money=money*10
else:
pass
print(money)
0
what
0
its \"
- 1
a=input("enter the money")
if a=='1' or a=='2' ora=='3' or a=='4' or a=='5' :
a=a*10
print(a)
this will make money 10 times ..hope this helps