3.
What is the use of the input() function? Give example.
Answers
Answered by
0
Explanation:
In Python, we use input() function to take input from the user. Whatever you enter as input, the input function converts it into a string. If you enter an integer value still input() function convert it into a string.
Answered by
1
Answer:
The input() method reads a line from the input (usually from the user), converts the line into a string by removing the trailing newline, and returns it. If EOF is read, it raises an EOFError exception.
Python input() Function Example 2
# Python input() function example.
# Calling function.
val = input("Enter an integer: ")
# Displaying result.
val = int(val) # casting into string.
sqr = (val*val) # getting square.
print("Square of the value:",sqr)
Similar questions
Science,
2 months ago
Social Sciences,
2 months ago
English,
5 months ago
Chemistry,
11 months ago
Social Sciences,
11 months ago