+ 1
What is the output of this code
Num=7 If num> 3: Print("3") If num==7: Print("7") Option 👉a) none ,b)print (3), c) print (7) D) all of the above
63 ответов
+ 9
Good Lord ! Why would you use 'If' and 'Print' and both Num and num in one place??
Learn the difference between uppercase and lowercase letters first.
+ 6
Oma Falk because "If" instead of "if", and "Print" instead of "print" etc?
+ 4
The output will be :
3
7
''' When you use if operator followed by if operator then both the expression would be executed irrespective of the expression being true or false'''
+ 4
It will throw error. As here If👈is used. It should b if.
+ 3
First: Num and num are not same. So if we consider it as a program (a) will be the output.
Second: If we consider it as a typing mistake then the output will be (a)
Explanation: first we can see num's value is 7 which is greater than 3 so it will print 3. Now as you haven't used "else", instead of skipping the next code, python will check it against the condition as it has a "if" part. And as 7 is equal to 7 it will print 7 onto the console.
So the final answer will be 37.
Option D says all but alone a or b will not be printed.
+ 2
Anananel yes
BTW
copy to codeplayground will do it.
+ 1
This is a basic calculation that could have been done in the code playground.
If the "nim" is meant to be "num" then the answer will output "3 7". So, it'll be D.
+ 1
That's the comparison operator, it checks in this context of the variable num equals 7, it it does it will print 7 otherwise nothing will happen.
+ 1
Ok thanks
+ 1
error
the output is error
+ 1
Output is 3 7
+ 1
Output:
Traceback(most recent call last)
if num>3
NameError name 'num' is not defined
+ 1
Nothing because the variable Num if different to num and the if statement is not write it correctly and the print function too.
+ 1
num=7
if num > 3:
print("3")
if num==7:
print("7")
Here is what u would want to write
also the output is:
3
7
+ 1
That would be 3 if the 'else' preceeds the if statement, or the whole value would have collapsed if the return statement preceeds the if. if i'm right.
+ 1
The problem is in the code
+ 1
None bc u had to use "elif" instead of the second "if"
+ 1
Yup
+ 1
error
+ 1
no