+ 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'

29th Jun 2016, 12:23 PM
Xenonium Oxygen
Xenonium Oxygen - avatar
12 Réponses
+ 10
money = int(input("enter a number")) if money >0 && money <6 : money *=10
2nd Jul 2016, 7:01 PM
Tomer Gal
Tomer Gal - avatar
+ 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.
30th Jun 2016, 6:51 AM
Rituraj Mehra
Rituraj Mehra - avatar
+ 1
n = int(input()) money = n*10 if 0<n<6 else None if not money: print('Incorrect input.')
19th Nov 2016, 8:33 AM
donkeyhot
donkeyhot - avatar
0
MY GOD, THANK YOU SO MUCH!
29th Jun 2016, 12:55 PM
Xenonium Oxygen
Xenonium Oxygen - avatar
0
uw
29th Jun 2016, 1:17 PM
Nishant Sardana
Nishant Sardana - avatar
0
برو بمیر
29th Jun 2016, 8:03 PM
MohammadHosein Ahmadi
MohammadHosein Ahmadi - avatar
0
😎
29th Jun 2016, 8:04 PM
MohammadHosein Ahmadi
MohammadHosein Ahmadi - avatar
0
type casting in p*
6th Jul 2016, 6:08 PM
naveen panjala
naveen panjala - avatar
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)
10th Jul 2016, 5:48 AM
ritik tiwari
ritik tiwari - avatar
0
what
7th Sep 2016, 5:21 PM
Gustavo Gomez Pabon
Gustavo Gomez Pabon - avatar
0
its \"
7th Sep 2016, 5:24 PM
Gustavo Gomez Pabon
Gustavo Gomez Pabon - avatar
- 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
29th Jun 2016, 12:31 PM
Nishant Sardana
Nishant Sardana - avatar