Why isn't 'x' acting as a variable here? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why isn't 'x' acting as a variable here?

I did this in code playground -- x= int(input()) if x > 5 print("x is greater than 5) print("program ended") Here, the 'x' in the print function (after the indentation I mean) is not acting as a variable... It does not take the value I give it. If I give x a value of 6, the output comes as -- x is greater than 5 program ended I want the out put as -- 6 is greater than 5 program ended How can I do it?

1st Jul 2017, 7:04 AM
srihitha reddy
srihitha reddy - avatar
1 Answer
+ 1
You do not state what the language is but I expect you need to put something like print(x + " is greater than 5.") hope this helps.
1st Jul 2017, 7:18 AM
[A^dr3w]
[A^dr3w] - avatar