# Introduction to Python

# Contents:
# * Input and output commands (I/O)
# * Arithmetic
# * Assigment and Comparison Operators
# * Logical Operators
# Link to all keywords in python: https://docs.python.org/3/reference/lexical_analysis.html#keywords
# Link to built-in functions: https://docs.python.org/2/library/functions.html

# ---------
#    I/O
# ---------
# input() : Input from keyboard
# print() : Print to console
#
# Note: The character '#' is a comment character. The interpreter ignores
#       everything after the '#'.

name = input('What is your name? ') # The input from the keyboard must be in quotes. Why?
print("Your name is " + name)
# Note: single quotes and double quotes are basically the same.

# ** Practice **
# Ask the user for their age and print it to the screen

# ----------------
#    Arithmetic
# ----------------
# + : addition
# - : subtraction
# * : multiplication
# / : division
# % : modulus (gives remainder)
# ** : exponentiation (note different than excel!)

print()
print('3 + 2 = ', 3+2)
print('3 - 2 = ', 3-2)
# Note: a semicolon lets one combine actions on a single line. 
# Does it print on one or two lines? Why?
print('3 * 2 = ', 3*2); print('3 / 2 = ', 3/2)
print('3 % 2 = ', 3%2)
print('3 ** 2 = ', 3**2)

# ** Practice **
# Calculate how many seconds there are in 6 years and 7 months. Print it to the console.

# ------------------------------
#    Assignment and Comparison
# ------------------------------
# = : assignment, x <-- y (not equals!)
# += : increment, x+=y is the same as x = x + y
# -= : decrement, x-=y is the same as x = x - y
# == : equals
# >  : greater than
# <  : less than
# >= : greater than or equal to
# <= : less than or equal to
# != or <> : not equal

x = 4
y = 3
print('')
print('x == ', x)
print('y == ', y)
print('x == y ?', x == y)
print('x > y ?', x > y)
print('x < y ?', x < y)
x+=5
print('x += 5', x)

# ** Practice **
# Check if five cubed is greater than, less than, or equal to three to the fifth power.

# -------------
#    Logical
# -------------
# and : logical and (binary)
# or : logical or (binary)
# not : logical not (unary)

my_bool = False
print('my_bool', my_bool)
print('my_bool OR True = ', my_bool or True)
print('my_bool AND True = ', my_bool and True)
print('NOT my_bool NOT True = ', not my_bool)

my_bool = True
print('my_bool', my_bool)
print('my_bool OR True = ', my_bool or True)
print('my_bool AND True = ', my_bool and True)
print('NOT my_bool = ', not my_bool)

# ** Practice **
# What is (True AND False) OR (False AND False)?

