examples of data type casting in python programming

0

All Contributions

#examples of casting in python

x="4"
y="7"
result=x+y #it will add it to each other as a strings, not numbers
print(result) #prints 47

x=int(x)
y=int(y)
result=x+y #now will sum it as numbers
print(result) #prints: 11

total contributions (1)

need a help?


find thousands of online teachers now

New to examplegeek.com?

Join us