Created
July 20, 2017 04:28
-
-
Save MattSegal/3a712d821e7544796700b57b0db2f789 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This works fine | |
print("hey " + "you!") | |
# This causes an error because "hey" is a string and 1 is an integer | |
print("hey " + 1) | |
foo = "hey " + 1 # This is an error too | |
print(foo) | |
# This works fine - the argument is an integer | |
print(1) | |
# also works fine - the argument is a string | |
print ("1") | |
# Here we convert the integer 1 to the string "1" - no error | |
print("hey " + str(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment