input |
| input(prompt) -> string |
Returns a line from standard input (built-in). |
| prompt | ?? |
| REMARKS |
| * This is a built-in function. * If the prompt argument is present, it is written to standard output without a trailing newline. * The function then reads a line from input, converts it to a string (stripping a trailing newline), and returns that. When EOF is read, EOFError is raised. Example: * If the readline module was loaded, then input() will use it to provide elaborate line editing and history features. * For the Official documentation refer to python.org |
num1 = input("enter a number")
cost = int(input("What is the cost?"))
# One line in body
if cost > 5:
discount = 1
price = 2
# Two lines in body
if cost > 5:
discount = 2
price = 3
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top