- 1

What is the answer

11th Apr 2017, 6:46 AM
anuj rathore
9 odpowiedzi
+ 3
That's great anuj, now I've learned something too
11th Apr 2017, 7:08 AM
Ghauth Christians
Ghauth Christians - avatar
+ 4
=10 y =20 ifx>y: print(statement) else: print (else) I got the correct answer
11th Apr 2017, 7:06 AM
anuj rathore
+ 1
What is the question
11th Apr 2017, 6:47 AM
Ghauth Christians
Ghauth Christians - avatar
+ 1
x=10 y =20 if(x>y) print(statement) else print (else) I don't know the correct syntax for python but it should look something like that
11th Apr 2017, 6:58 AM
Ghauth Christians
Ghauth Christians - avatar
+ 1
Then correct me
11th Apr 2017, 7:00 AM
Ghauth Christians
Ghauth Christians - avatar
0
x=10 y =20 _x>y_ print(statement) ____ print (else)
11th Apr 2017, 6:54 AM
anuj rathore
0
no bro worng
11th Apr 2017, 6:59 AM
anuj rathore
0
=10 y =20 ifx>y_ print(statement) else: print (else) idk what after the y
11th Apr 2017, 7:04 AM
anuj rathore
0
You might want to go through this systematically :) 1. If you want to compare two "variables", they both need to exist and have a value. So, the first blank needs to be filled with x. This will give a proper assignment: x = 10 2. if-clauses MUST end with a colon - that's the law ;-) Consequently, the third line must be if x > y: Note that there must be a blank between "if" and "x", but we do not need parenthesis around the expression x > y. Python is not Java ;-) There are cases with multiple conditions where parentheses are necessary, but that's not the case here. As far as the else clause is concerned, you will need the trailing colon again, followed by proper indentation of those statements that need to be executed in case the if-clause is evaluated to False and the else-clause kicks in. I hope I made myself clear enough without providing the full solution (and spoiling the fun).
11th Apr 2017, 7:58 AM
Klaus-Dieter Warzecha
Klaus-Dieter Warzecha - avatar