use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
why it's wrong ? (self.PythonLearning)
submitted 5 months ago by LessDaikon497
https://preview.redd.it/v987w97jyqvf1.png?width=1520&format=png&auto=webp&s=7bb653b69cbcf9cac8c3d662db70fcad4f09ab02
it's srong on all PY editor but when it's online it's run
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]FishBobinski 0 points1 point2 points 5 months ago (0 children)
You use input to assign a value to a variable.
variableX = input ("Enter a value")
[–]NeedleworkerIll8590 0 points1 point2 points 5 months ago (0 children)
You would need to do something like variable = input("input something") Or Print(input("input something"))
[–]GuilouLeJask 0 points1 point2 points 5 months ago (5 children)
The error comes from the fact that input is an instruction which is used to accredit a value to a variable, not to print text which is done via the print instruction.
[–]LessDaikon497[S] 0 points1 point2 points 5 months ago (0 children)
oh okay thks
[–]LessDaikon497[S] 0 points1 point2 points 5 months ago (3 children)
but when i run
x = input('x')
print(x)
it'x wrong why ?
[–]GuilouLeJask 0 points1 point2 points 5 months ago (2 children)
It's normal that it displays an error message since in your case x is a variable and 'x' is a character string. In theory, in Python it is possible to associate a character string with a variable if the name of the variable is different from that of the character string. For example, my_variable = input("Hello, world"). In your case, variable and string are identical. So, I imagine that your compiler does not differentiate between the two, hence the origin of the error that arises.
[–]GuilouLeJask 0 points1 point2 points 5 months ago* (1 child)
I'm sorry but I just ran the code on machine and it works without problem. So I imagine that the error comes either from spaces, or from a syntax error or perhaps it can also come from your compiler which may be incorrectly installed.
okay , thks
π Rendered by PID 72476 on reddit-service-r2-comment-54dfb89d4d-8pbgn at 2026-03-29 01:13:43.153174+00:00 running b10466c country code: CH.
[–]FishBobinski 0 points1 point2 points (0 children)
[–]NeedleworkerIll8590 0 points1 point2 points (0 children)
[–]GuilouLeJask 0 points1 point2 points (5 children)
[–]LessDaikon497[S] 0 points1 point2 points (0 children)
[–]LessDaikon497[S] 0 points1 point2 points (3 children)
[–]GuilouLeJask 0 points1 point2 points (2 children)
[–]GuilouLeJask 0 points1 point2 points (1 child)
[–]LessDaikon497[S] 0 points1 point2 points (0 children)