num=int(input ("enter any number "))
num2=float(input(" enter second number "))
a=num+num2
print(a)
¿What will be the output(Python)?
Answers
Read input as a float in Python
Python | read/take input as a float: Here, we are going to learn how to read input as a float in Python?
Python | read/take input as a float: Here, we are going to learn how to read input as a float in Python?Submitted by Include Help, on April 02, 2019
Output
OutputEnter any value: 10
OutputEnter any value: 10value of va l1: 10
l1: 10type of va l1: <class 'str'>
l1: <class 'str'>Enter another value: 10.23
l1: <class 'str'>Enter another value: 10.23value of va l2: 10.23
l2: 10.23type of va l2: <class 'str'>
l2: <class 'str'>Enter another value: Hello
l2: <class 'str'>Enter another value: Hellovalue of va l3: Hello
l3: Hellotype of va l3: <class 'str'>
See the program and output – Here, we provided three value "10" for va l1 which is an integer value but considered as a string, "10.23" for va l2 which is a float value but considered as a string, "Hello" for va l3 which is a string value.
Answer:
num=int(input ("enter any number "))
num2=float(input(" enter second number "))
a=num+num2
print(a)