Computer Science, asked by Priyaurmaliya39, 3 months ago

3.
What is the use of the input() function? Give example.​

Answers

Answered by Anonymous
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 sanikapandya8
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