Operators ============================== Examples in Python 3 ### Numeric values ```python """ Addition """ x = 40 + 2 print(x) """ Subtraction """ x = 8 - 50 print(x) """ Multiplication """ x = 6 * 7 print(x) x = 5.6 * 7.5 print(x) """ Division """ x = 126 / 3 print(x) # float x = 126 // 3 # integer print(x) x = 71.4 / 1.7 print(x) x = 71.4 // 1.7 print(x) """ Powers """ x = 5**2 print(x) x = 2**10 print(x) x = 6.49**2 print(x) """ Modulus """ x = 242 % 50 print(x) ``` ### Strings ```python """ Concatenation """ x = "Hello" + "World" print(x) x = "Hello" y = "World" print(x + " " + y) print(x, y) x = "4" y = "2" print(x + y) print(x, y) """ Multiplication """ x = "Na" * 10 print(x + " Watman!") ``` Reference and read more ------------------------------ [Operators](https://docs.python.org/3/reference/lexical_analysis.html#operators) [Mapping Operators to Functions](https://docs.python.org/3/library/operator.html#mapping-operators-to-functions) [Numbers](https://docs.python.org/3/tutorial/introduction.html#numbers) [Strings](https://docs.python.org/3/tutorial/introduction.html#strings) Revision history ------------------------------ 2014-07-16 (sylvanas) PA1 First try.