Augmented assignment operator

name = 'John Doe'
age = 26

name_and_age = name + str(age)
print(name_and_age) # John Doe26
coild someone please explain where the "str" came from. i wanna understand

Also, 
can someone please explain the augmented assignment operator += and hw it is used?

Try doing a web search for “python str()”. It’s a built-in Python function.

These are equivalent

a = a + b
a += b

Try doing a web search for “python augmented assignment operator +=” for more information

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.