How will you change an entered value using the input() function into the integer type?
in python
Answers
Answered by
6
Answer:
- Whenever an input is taken in python, the input() function converts the line to string.
- To change the entered value to integer type, we use int() function.
- The int() function returns the integer object from any number or string.
- For example, when we want to input a number, say n, we can write the given códe - n = int(input("Enter a number: "))
Answered by
1
To change a entered string value into integer type you need to declare the variable into integer in this way,
a=input("Enter value")
a=int(a)
The first line took the input and then the second life converted it into integer type...
Similar questions