175k views
5 votes
Can anyone please help with this programming code in python num= 7 if num > 3: print(“3”) if num < 5: print(“5”) if num == 7: print(“7”) and please explain step by step cause I’m confuse

1 Answer

3 votes

Answer:

The program will print out:

3

7

Step-by-step explanation:

Let's replace "num" with what this variable is defined to in all of you if statements.

First if statement:

if 7 > 3:

print("3")

Result: 7 is indeed greater then 3, so it will print "3"

Second if statement:

if 7 < 5:

print("5")

Result: 7 is not less than 5, so it will not print "5"

Third if statement:

if 7 == 7:

print("7")

Result: 7 is equal to 7, so it will print "7"

User Kuboon
by
4.7k points