Concatenation in Python in 60 seconds or less!

 

Concatenation is about joining different types of objects in Python together.

Python classes different datatypes inside a print function as objects. Python can’t handle different datatypes (or objects) at one time unless all objects are the same datatype.

We can use the int()function to convert string objects to an integer for example.

x = "16"

print(5+int(x))

 

and we can also convert integer objects into a string using the str()function like so:

x = "16"

print("Lily is "+str(x))

 

Series links

Posted in Uncategorized.

Leave a Reply

Your email address will not be published. Required fields are marked *

*