Computer Applications
To convert input received via raw_input( ) of Python 2.x in a numeric type, which of the given functions can be used ?
- convert( )
- float( )
- int( )
- No conversion required as input is already in desired form.
Python Funda
3 Likes
Answer
float( ) and int( )
Reason — Python offers float( ) and int( ) functions to be used with rawinput() to convert the values received through rawinput() into integer and float types.
Answered By
1 Like
Related Questions
Which of the following allow you to take input from user ?
- raw_input( )
- enter( )
- eval( )
- input
Which of the following functions will you use to find out the type of a variable ?
- datatype( )
- type( )
- typeof( )
- dtype( )
To convert input received via input( ) of Python 2.x in a numeric type, which of the given functions can be used ?
- convert( )
- float( )
- int( )
- No conversion required as input in already in desired form.
How are floating constants represented in Python ? Give examples to support your answer.