Please help it's urgent
today's my exam at 1pm
Chapter - conditional statements and loops
Please don't post irrelevant or unrelated answers to the question otherwise 20 answers will be reported
Answers
Given codes:
Friday = False
if Friday:
print "Jeans day!"
else:
print "Dress code"
Output:
Dress code [Option (a)]
Reason:
An if-else structure is used to test given expressions.
- It follows a similar syntax:
if <test expression>:
statement
else:
statement
- The 'if' statement will only be executed if the given test expression results to True.
Here, we are given that Friday = False.
Which means, that the if test expression is false. Hence it moves to the else statement, which is to print Dress code.
Language used :-
Given Code :-
Friday = False
if Friday:
print "Jeans day!"
else:
print "Dress code"
Output :-
➝ "Dress code"
The "Jeans day!" statement is executed as the false for Jeans Day which is not for friday.
Syntax for the Following :-
Statement
if (condition):
print. statement
else (condition):
print. statement
Explaination :-
The Condition is True when block executed & False when else block executed.
Friday don't satisfy as the if is false.
So, We use it else now .
So , it gives Output as Dress code.
________________________________