Advertisement

Learn Python Programming 7 - Variable Types and Type Casting (with Examples)

Learn Python Programming 7 - Variable Types and Type Casting (with Examples) Learn Python Variable Types

Apples = input("Enter the Value of Apples: ")
Oranges = input("Enter the Value of Oranges: ")

print (Apples)
print (Oranges)

#print (Apples + Oranges)
print ("Before typecasting, type of Apples is ", type(Apples))
print ("Before typecasting, type of Oranges is ", type(Oranges))

Apples = int(Apples) #casting from string to integer
Oranges = int(Oranges) #casting from string to integer

print ("After typecasting, type of Apples is ", type(Apples))
print ("After typecasting, type of Oranges is ", type(Oranges))

print (Apples)
print (Oranges)

print ("Total fruits, result is ", Apples + Oranges)

Learn Python,Python variable types,Learn Python in tamil,

Post a Comment

0 Comments