###############################################################################
# ---------------- 15-112 Recitation Week 1: Getting Started ---------------- #

# This is a starter file of the problems we did in recitation. A good way to
# use this file is to try to re-write problems you saw in recitation from
# scratch. This way, you can test your understanding and ask on Piazza or
# office hours if you have questions :)

# --------------------------------------------------------------------------- #
###############################################################################
# Functions
###############################################################################
# LEARNING OBJECTIVES
# What is a function and when would we use it?
# What is a return statement?
# What are the structural elements of a function (i.e. def, the parameters, the colon, the body, the return, etc)?
# What is a function call? How do we use this for testing and debugging?


# write a function that returns n times 6
def timesSix(n):
    return 42

# write a function that returns the average of n and m
def average(n, m):
    return 42

# write a function that returns n raised to the p power
def pow(n,p):
    return 42

# write a function that returns the 100s value of n
def returnHundredsValue(n):
    return 42


# write a function that calculates the slope of a line given two points
def slope(x1, y1, x2, y2):
    return 42

###############################################################################
# Conditionals
###############################################################################
# LEARNING OBJECTIVES
# What are conditionals?
# Basics of if-elif-else statements.
# Whether to use elif or not.
# How does short circuit evaluation work?

def lessThan(n):
    if n < 100:
        print("yes")
    elif n < 200:
        print("maybe")
    else:
        print("no")

def willThisCrash(x):
    if x < 6 or x / 0 == 6:
        return True
    return False

willThisCrash(4)

def nowWillThis(x):
    if x < 6 and x / 0 == 6:
        return True
    return False

nowWillThis(4)



###############################################################################
# Problem: roundPegRectangularHole
###############################################################################
# LEARNING OBJECTIVES
# How do we approach a problem?
# How do we think in a 2D space?
# What are conditional statements and when do we use them?


# roundPegRectangularHole(r, w, h) returns true if a round peg with radius r can 
# pass through a rectangular hole with width w and height h, and false otherwise.
def roundPegRectangularHole(r, w, h):
    return False



###############################################################################
# Code Tracing
###############################################################################
# LEARNING OBJECTIVES
# What is code tracing?
# Why is this technique useful? 
# When might we see code tracing problems?
# How do we approach code tracing problems?


def ct(x):
   x -= 1
   print(x**2)
   x %= 4
   return ((x * 2) % 4) // 2
# print(ct(6))

###############################################################################
# Reasoning Over Code
###############################################################################
# LEARNING OBJECTIVES
# What is reasoning over code? 
# How do we approach reasoning over code problems?


def rc(n):
    assert(type(n) == int)
    if ((n < 0) or (n > 99)): 
        return False
    d1 = n%10
    d2 = n//10
    m = 10 * d1 + d2
    return ((m < n) and (n < 12))
# n = ANSWER HERE
# print(rc(n))