0
Hi,i want to get an integer from user . what should i do?
a=input("enter num : ") this is my code . but it gets a string. not an intiger
16 Answers
+ 9
a = int(input("Enter number: "))
Try it out. It'll cast the string into int.
+ 2
max = a
for i in [a,b,c]:
if i > max:
max = i
print(max)
+ 2
max([a,b.c])
not
max[a,b,c]
+ 1
samanehs solution is very good.
you can wrap a try/catch around it.
will not work in sololearn
+ 1
u know how to input in sololearn?
+ 1
print(max[a,b,c])
0
Thanks alot
0
a=int(input("add\n"))
b=int(input("add\n"))
c=int(input("add\n"))
if(a > b & a > c):
print(a)
else:
if(b > a & b > c):
print(b)
else:
if(c > a & c > b)
print(c)
this is my code but it dosn't work yet
0
The if statement is not correct
0
Do u know what should i do?
0
yes for ex 1 press enter then 2 again press enter 3
0
You can copy and try it yourself
0
thanks for this . but do u know how can i use from for state?
0
and i tried it . max[] . but it doesn't work too
0
thanks . the last way worked ♥
0
yes it worked