+ 3

What is the else statement?

25th Oct 2018, 5:31 AM
MUHAMMAD RIFQI RAHMATULLAH
MUHAMMAD RIFQI RAHMATULLAH - avatar
13 Antworten
+ 7
so you have a if statment: #Created By: H4CK3R😺😺C4t😺😺 if x == 10: print(x)#so we did are if statment we have a backup else to make sure that or “else” something else happens lets add it here: else: print(“Somethings wrong”)#You can use the code only if you upvote this answer.
25th Oct 2018, 9:00 PM
Potato Hacker
Potato Hacker - avatar
+ 5
So in Python is useful when you add If statements. For example X = 4 if 6 == X: print ("OK") else: print ("Error") So else allows you to put into your code the action which program has to do if "IF" is not true Look how it works in normal code I hope that I helped you a bit 😊 https://code.sololearn.com/cjLtBzq3RnYs/?ref=app https://code.sololearn.com/cpwcRrrAuHwn/?ref=app
25th Oct 2018, 5:37 AM
Małgorzata
Małgorzata - avatar
+ 3
you have if statements that checks if an given condition is true and if that condition is false the else statement will be excecuted
25th Oct 2018, 5:37 AM
Mbrustler
Mbrustler - avatar
+ 2
The 'else' statement is a statement that runs if the 'if' statement given if false.
25th Oct 2018, 1:30 PM
Akeem Sanyaolu
Akeem Sanyaolu - avatar
+ 2
if the if statement fails no matter the condition the else statement will run the code example in python: if 2 == 4: print("5") else: print("4") output would be 4 to apply a condition to else statement (in python) use the elif instead if 2 == 4: print("4") elif 2 == 2: print("5") output would be 5
25th Oct 2018, 10:09 PM
Daggerhound
Daggerhound - avatar
+ 2
else statement in programming is a conditional statement that runs a different set of statements depending on whether an expression is true or false.
26th Oct 2018, 6:10 AM
Andrew Watts
Andrew Watts - avatar
+ 2
else is a keyword which is use for decision making statement.it is always with if . That means if condition is true then if statement is executed otherwise else statement is executed.
26th Oct 2018, 4:36 PM
Manoj Kumar
Manoj Kumar - avatar
+ 1
It is basically a logic statement, I think. It is based on what you need, by checking your statement with true or falsity. Example: If you assume Earth is round, then all say 'yes, you're right'; because Earth is actually round, so this statement/assumption made by you is true. else all say 'no, you're wrong'. The 'else' statement is a statement that runs if the 'if' statement given is false.
26th Oct 2018, 7:56 AM
Pranab Ranjan Mandal
Pranab Ranjan Mandal - avatar
+ 1
hi
26th Oct 2018, 10:06 PM
yusuf visa
+ 1
'else' is a part of the 'if' conditional statement. You cannot write 'else' without the 'if'. 'if-else' contains a condition that returns 'true' or 'false'. When the condition returns 'true', the code on the 'if' statement will be executed. When it returns 'false', it will execute the 'else' statement. if (age >= 21) access = 'granted'; else access = 'denied';
27th Oct 2018, 12:20 AM
Carlette Jean A.
0
yb
26th Oct 2018, 10:06 PM
yusuf visa
0
the else statement is used when there are two different possible results with different outcomes of the if statement if NumApples <10 enough = "no" else enough ="yes"
27th Oct 2018, 4:14 AM
Zach N.
Zach N. - avatar
0
Hello
1st Nov 2018, 11:41 PM
NGUEMETA TCHOFFO ANDRE YVES
NGUEMETA TCHOFFO ANDRE YVES - avatar