0
What is the problem with this code? x=input(2) y=input(8) print (int(x)+int(y))
14 Answers
+ 3
Here in input u passed number 2 and 8 your input function will take inputs generally we writting some text with input like this
input("enter num") like this text will show whatever mesg u have given it will print then it ask for input here u passed values its treat as string if u will not write int thats why first it will print
28 in result then input numbers will be add if u entered
3
And
2
Then final output will be
285
where 5 is addition of two input numbers and 2 ,8 are strings.
+ 2
zoro its optional and not necessary to pass message or values if u dont want to write anything .u can
input () this is also valid
+ 2
learn basics fundamental of python you will understood much better
a=input()
b=input()
c=a+b
print(c)
+ 2
Not false if u want to pass string then u need to write double quotes .
If u want to pass number then write without quotes
+ 1
zoro read @A.S first answer again. Argument(I.e inside parenthesis), to input() is just a message to print on console for your or reader understanding..
x=input() will accept a string value..
but if you have some more inputs needed like
x=input()
x2=input()
...
a 10+ more , you can't understand what to input . but with
x1=input("enter value for x1 ")
x2=input("enter value for x2 ")
will notify you to enter value for x1,next for x2 with messages you passed. Simplifies understanding. It's not value assigning.. if you want assigning,just write
x=2
y=8
+ 1
Can someone solve this Python code for me 0.01*(2**5)
+ 1
Input () is a built in python function that does just that, takes user input. This input is provided at runtime hence you should not include it in the code.
0
Why the code is true when we do not write the numbers
0
Could you give me an example please?
0
I am sorry if I disturb you
I'm a bignner
Thank you
0
https://code.sololearn.com/ca8A104A21a2
a=input()
b=input()
print(int(a)+int(b))
0
Fatorma Amadu
As per your question, 0.01(2**5) = 0.32
But what help you need in this kindly elaborate.
- 1
but if we want to write it with 2 and 8 is it false?