+ 6
I can't understand how the program is running
Please some one explain that
17 Respostas
+ 4
example:
x = 1 + 1
y = 2
if x == y:
print('True')
else:
print('False')
This will print 'True'
the if statement will not occur if the condition is false, the else statement occur.
+ 3
Input consider as a string???
+ 2
'print' not 'Print'
and
n = int(input())
+ 1
n=input ()
if n==5:
Print ('true')
else:
print('false')
The question is even though I put 5 the results show false why?????
+ 1
Ok that's not a problem
+ 1
Just run the program and put 5 and see what will happen
+ 1
Input operation consider the value as string whatever I put correct
As I'm correct
+ 1
Thank u so much
+ 1
if statement : if a condition is satisfied such as (if 2==2 :
print("true"))
else statement : if a condition is not satisfied
0
0
try to review the sololearn lessons again and experiment until you understand it. Happy coding!
0
It's always show's false
0
try this
n=int(input ())
if n==5:
print ('true')
else:
print('false')
0
input ()
Operation work in if statement?????????
0
Yes it's working how
0
because the 5 youre trying to type is a string not an integer, you must convert it first to integer by adding int befor the number
int(x)
0
The input you are giving is always a string, and Python does not convert it to an integer. So you must explicitly convert the string to an integer, as said by The Zen of Python:"Explicit is better than implicit".