TYPE CONVERSION IN PYTHON

GOCOURSE



Type Conversion

The process of converting one data type to another is known as type conversion. Type casting describes this transformation.

Syntax:

<required data type> (expression)

Example:

Float1= 38.0098  # float value
int1=int(float1)  #convert to integer
print(int1) #print 

Program:


  mynum=38.0098
  print("This float number:",mynum)
  myconvertnum=int(mynum)
  print("Converted number is integer:",myconvertnum)


Output:


  This float number:38.0098
  Convert number is integer:38







More topic in Python

Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send