© 2019 BrainStemSchool.com

December 13, 2016

December 9, 2016

December 7, 2016

Please reload

Mysterious Printing Errors

November 19, 2016

 

https://youtu.be/uyYPihp1DfA

print(5+5)

 

Prints 10

 

print("5"+5)

 

Gives the following error:

 

Can't convert 'int' object to str implicitly

 

and strangely the order matters

 

print(5+"5")

 

unsupported operand type(s) for +: 'int' and 'str'

 

Exactly why they are different in the way that they are is not what's important right now. What's important is that you're trying to combine different types and python doesn't know how to do that without help.

 

Brief List of Python Types


int - whole numbers for counting

float - decimal point numbers

str - strings of text

bool - boolean True or False

 

There are more but this short list will get you started.

 

Next Post; String Delimiters

Share on Facebook
Share on Twitter
Please reload

Please reload

Recent Posts
Tags