- 1

num = 12 if num > 5: print("Bigger than 5") if num <=47: print("Between 5 and 47")

Bro how is possible

10th Oct 2020, 2:16 AM
Hacker Tamil Tamila
Hacker Tamil Tamila - avatar
5 odpowiedzi
+ 2
It's print both. Because 12 is greater than 5 and also less than 47.
10th Oct 2020, 2:26 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 2
In simple you can also rewrite your code as below num = 12 if num > 5 and num <=47: print("Bigger than 5") print("Between 5 and 47")
10th Oct 2020, 2:28 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 1
It's a nested if statement. In the true case of first statement the second statement runs. If first statement is false than the second statement didn't run.
10th Oct 2020, 2:24 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 1
Exactly what answer you need? Related to condition or output mention what output you need
10th Oct 2020, 5:19 AM
Azhagesanヾ(✿)
Azhagesanヾ(✿) - avatar
- 1
bharathi = 10 if bharathi < 5: print("tamil") if bharathi <= 10: print("hello") Bro
10th Oct 2020, 2:31 AM
Hacker Tamil Tamila
Hacker Tamil Tamila - avatar