What is the purpose of the parentheses after the input function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the purpose of the parentheses after the input function

name = input() print(name)

10th Jul 2022, 3:30 PM
Alex | Python Instructor & Solutionist Thinker
Alex | Python Instructor & Solutionist Thinker - avatar
3 Answers
+ 1
print is a function. print(name) is a function call. input is a function. input() is a function call. Try entering a string argument into the parentheses and see what happens. For example: name = input("What is your name?")
11th Jul 2022, 12:58 AM
Chris
Chris - avatar
+ 5
Hi Alexandre NAROLLES / Solutionist Thinker In Python a function is called with parentheses. Inside it you can put arguments, if the function allow it. In Python input is a function, and not a statement. You can read about it by running: help(input)
10th Jul 2022, 3:35 PM
Per Bratthammar
Per Bratthammar - avatar
+ 1
The purpose is that you can add some text before the cursor.
10th Jul 2022, 3:37 PM
Jan
Jan - avatar