Say I define a function with a parameter of (x). Is it possible to use input provided by the user, saved into a variable (x), that is used as the parameter of the function?
-
Can you provide an example of usage please?Tom Burrows– Tom Burrows2017-03-03 12:33:56 +00:00Commented Mar 3, 2017 at 12:33
-
marked as duplicate, ping me if you heavily edit your question I'll reopen otherwise you have you answer in the link.Jean-François Fabre– Jean-François Fabre ♦2017-03-03 12:38:06 +00:00Commented Mar 3, 2017 at 12:38
Add a comment
|
1 Answer
If you're using Python2 try raw_input method:
x=raw_input("please input a string")
Or in Python3 try input method:
x=input("please input a string")
3 Comments
Tom Burrows
I don't think this is what the OP wanted, but maybe I'm wrong. Also, please at least provide a link to usage instruction, or add an explanation your self.
Jean-François Fabre
if that's what the user wants, then the duplicate link is enough.
McGrady
@Jean-FrançoisFabre That's right