August 2024
Intermediate to advanced
256 pages
5h 34m
English
The input() function is used to accept user input from the console. This function prompts the user with a message and waits for input.
name = input(“Enter your name: “)
The input is returned as a string, so you may need to convert it to the desired data type. Here, we’re converting the string input to an integer.
age = int(input(“Enter age: “))
Read now
Unlock full access