CBSE Class 9 Computer Applications Question 6 of 23

Introducing Python — Question 4

Back to all questions
4
Question

Question 4

To convert input received via raw_input( ) of Python 2.x in a numeric type, which of the given functions can be used ?

  1. convert( )
  2. float( )
  3. int( )
  4. No conversion required as input is already in desired form.
Answer

float( ) and int( )

Reason — Python offers float( ) and int( ) functions to be used with raw_input() to convert the values received through raw_input() into integer and float types.