Hey If you are beginner and want to learn a python then you are on right path. Learn basic as well as advanced programming in Python.

Search

Typecasting in Python.

PYHTON PROGRAM




"""

 Program for typecasting and takes inputs from user

"""

A=input("Enter a name:")

a=(int(input("Enter a number:")))

b=(float (input("Enter a number 2:")))

print(type(a))

# type of a is integer.

Z=str(a)

#typecasting operation is performed.

print(Z)

#value of a and Z is same but types are different.

print(type(Z))


#type of a is now str.






*** Input && Output ***







No comments:

Post a Comment

let me know which type examples you want to comment me.