Numbers, Strings, and Boolean
# Example x = 0 x = "string" x = True x = False print ( x )
But, wait, it is strong typed!
# Example
a = 1
b = 2
s = "string"
print ( a )
print ( a,b )
print ( s )
print ( " The number is " + 123 ) ## Ding ding ding! Error!
## I know what you are thinking, "but this works in Java, right?"
Here is how to help them get along!
# Example print ( " The number is " + str(123) ) ## You know what, this works too! I love python! print ( " The number is ", 123 )
Operators
# Example x = x + 1 x += 1 x -= 1 y = x // 3 y = x % 3 x *= y + z x = x * (y+z) x /= y + z x = x / (y+z)
What do you think this will do?
x =+ 5 y =- 3
No comments:
Post a Comment