instructors = ['Dave', 'Joe', 'Dorkus the Clown']
instructors

print("dave")

for instructor in instructors:
    print(instructor)

for idx in range(len(instructors)):
    print(instructors[idx])

"""
Explanation: Flow of Control
Overview

Data basics
Theory of types
Basic types
Composite types: Tuples, lists and dictionaries
Functions
range() function
read and write files
Flow control
If
for

Flow of Control
<hr>

<img src="https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/lnpls008.gif">Flow control figure</img>
Flow control refers how to programs do loops, conditional execution, and order of functional operations.  Let's start with conditionals, or the venerable if statement.
Let's start with a simple list of instructors for these classes.
End of explanation
"""


for instructor in instructors:
    if not "Clown" in instructor:
        print(instructor)
    else:
        pass

for instructor in instructors:
    if "Clown" in instructor:
        pass
    else:
        print(instructor)

for instructor in instructors:
    if not "Clown" in instructor:
        print(instructor)
    elif not "z" in instructor:
        print(instructor)
    else:
        pass

if 'Dorkus the Clown' in instructors:
    print('#fakeinstructor')

"""
Explanation: If
If statements can be use to execute some lines or block of code if a particular condition is satisfied.  E.g. Let's print something based on the entries in the list.
End of explanation
"""


if 'Dorkus the Clown' in instructors:
    print('There are fake names for class instructors in your list!')
else:
    print("Nothing to see here")

"""
Explanation: Usually we want conditional logic on both sides of a binary condition, e.g. some action when True and some when False
End of explanation
"""


if 'Joe' in instructors:
    print("Congratulations!  Joe is teaching, your class won't stink!")
else:
    pass

"""
Explanation: There is a special do nothing word: pass that skips over some arm of a conditional, e.g.
End of explanation
"""


if True is False:
    print("I'm so confused")
else:
    print("Everything is right with the world")

"""
Explanation: Note: what have you noticed in this session about quotes?  What is the difference between ' and "?
Another simple example:
End of explanation
"""


my_favorite = 'pie'

if my_favorite is 'cake':
    print("He likes cake!  I'll start making a double chocolate velvet cake right now!")
elif my_favorite is 'pie':
    print("He likes pie!  I'll start making a cherry pie right now!")
else:
    print("He likes " + my_favorite + ".  I don't know how to make that.")

"""
Explanation: It is always good practice to handle all cases explicity.  Conditional fall through is a common source of bugs.
Sometimes we wish to test multiple conditions.  Use if, elif, and else.
End of explanation
"""


my_favorite = 'pie'

if my_favorite is 'cake' or my_favorite is 'pie':
    print(my_favorite + " : I have a recipe for that!")
else:
    print("Ew!  Who eats that?")

"""
Explanation: Conditionals can take and and or and not.  E.g.
End of explanation
"""


for instructor in instructors:
    print(instructor)

"""
Explanation: For
For loops are the standard loop, though while is also common.  For has the general form:
for items in list:
    do stuff
For loops and collections like tuples, lists and dictionaries are natural friends.
End of explanation
"""


for instructor in instructors:
    if instructor.endswith('Clown'):
        print(instructor + " doesn't sound like a real instructor name!")
    else:
        print(instructor + " is so smart... all those gooey brains!")

# Loops can be nested
for i in range(1, 4):
    for j in range(1, 4):
        print('%d * %d = %d' % (i, j, i*j))  # Note string formatting here, %d means an integer

# Can exist loop if a condition is met
for i in range(10):
    if i == 4:
        break

"""
Explanation: You can combine loops and conditionals:
End of explanation
"""


4 % 2

N = 100
for candidate in range(2, N):
    # n is candidate prime. Check if n is prime
    is_prime = True
    for m in range(2, candidate):
        if (candidate % m) == 0:
            is_prime = False
            break
    if is_prime:
        print("%d is prime!" % candidate)
    

"""
Explanation: Programming Example
Write a script that finds the first N prime numbers.
End of explanation
"""


