0

Strange input problem!

If I try the input "print("any string")" , the output comes out something like this: any string You entered: print("any string") result: None # why does this happen? # here is the code: https://code.sololearn.com/cEcsy8P3yurY/?ref=app

5th Nov 2019, 3:37 AM
Ishmam
Ishmam - avatar
5 Réponses
+ 3
eval converts strings into executable Python code. print is a function that returns None, because it's return wouldn't have big value. print(print("any string")) would print: any string None Because print("any string") evaluates to None
5th Nov 2019, 7:05 AM
Seb TheS
Seb TheS - avatar
+ 1
Oh, I see! Thanks Seb TheS for the brief explanation. 😄😄😄
5th Nov 2019, 3:08 PM
Ishmam
Ishmam - avatar
0
wet water ))) I think it's the magic of the function "eval() ". Please check out the code correctly. I just want the explanation of this code.
5th Nov 2019, 4:08 AM
Ishmam
Ishmam - avatar
0
Why are not using input method or function it is easy or u will be not confuse by it For example: a=input("any string:") Print(a) Thank you best of luck
5th Nov 2019, 4:35 AM
vikrant soni
vikrant soni - avatar