Why answer was not also 7 | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

Why answer was not also 7

3rd May 2018, 10:16 AM
Than Htet
7 ответов
+ 4
Is there some sample code you can provide?
3rd May 2018, 10:33 AM
jay
jay - avatar
+ 4
post a code in a question before posting it tho, who may know. so the issue here is that the last if statement is checking if the spam == "7", and that is a character (because of the quotes, string to be precise, characters are placed between single quotes ' '), and your spam variable is int value, so it cannot be directly transleted as 7 as a character, do you know what I am sayin'?
3rd May 2018, 10:44 AM
Paul
+ 2
spam = 7 if spam > 5: print("5") if spam > 8: print("8") if spam == "7": print("7")
3rd May 2018, 10:40 AM
Than Htet
+ 1
What is the question? There is no context provided
3rd May 2018, 10:31 AM
jay
jay - avatar
+ 1
If statement .
3rd May 2018, 10:32 AM
Than Htet
+ 1
Thanks mr .paup
3rd May 2018, 10:45 AM
Than Htet
0
In this code why answer not contain 7 .
3rd May 2018, 10:40 AM
Than Htet