0
num=12 of number>5: print ("bigger than 5")
good day; how are you guys doing. im new to coding and I am still struggling through the calculations for some reason and I would love some help knowing how you get about the answer for this code >>>("num=12 of number>5: print ("bigger than 5")")
6 Answers
+ 5
Steven, you can try this:
num = 12
if num > 5:
print ("num bigger than 5")
elif num == 5:
print("num equals to 5")
else:
print("smaller than 5")
instead of setting a fixed value to variable num, you can use input() to promt user a number:
num = int(input("enter a number: "))
if num > 5:
print ("num bigger than 5")
elif num == 5:
print("num equals to 5")
else:
print("smaller than 5")
in this case input value has to be converted to int as input() function always returns input as string.
+ 4
... I believe this is what you really mean.
num = 12
if num > 5:
print("bigger than 5")
num was defined as 12, which is larger than 5. The if statement is evaluated to true and the print statement is executed.
+ 2
#something like this
num=12
if num>5:
print ("bigger than 5")
+ 1
Steven Jhonby
<= means "smaller than or equal to". Since 12 is larger than 5, and also smaller than or equal to 47, the innermost print statement is executed.
0
thanks for the response.
I understood the starting but with the e.g from python it showed
>>>("
num=12
if num>5:
print ("bigger than 5")
which at the end showing
=47
after I ran the (e.g)
and that threw me of
num = 12
if num > 5:
print("Bigger than 5")
if num <=47:
print("Between 5 and 47") ?????