Go Loopy Go Crazy
Mama We Matrix
Real Iffy
String Strapped
Tay Keith, Function These Problems Up
100

The type of loop that allows me to control the number of times I enter it directly. 

What is a for-loop.

100

ListA = [1,2,3,4]

The value of ListA[-2]:

what is 3

100

Three parts of an IF statement 

What are IF, Else, Else if

100

The number of different types of quotation marks a string can have to define it as one

2

100

The three letter word that defines a function

def :

200

The type of loop that allows a conditional statement to control it.

What is a while loop.

200

Guess the output
numbers = [1, 2, 3, 4, 5]

squared = [num ** 2 for num in numbers] 

print(squared)

What is [1, 4, 9, 16, 25]

200

Guess the Output

x = 15

if x < 10

    print("A")

elif x < 20:

    print("B")

elif x < 30:

    print("C")

else:

    print("D")


What is B

200

Guess the output

def function(input_string):

    words = input_string.split()

    reversed_string = " ".join(reversed(words))

    return reversed_string


input_str = "Python is fun"

output_str = reverse_words(input_str)

print(output_str)


fun is Python

200

The code below gives an output of:

def up(x,y):

x+=x

return x + y

print(up(1,2))

What is 4

300

Output of 

for i in range(5,10): print (i)

What is 5,6,7,8,9

300

DRAW ON THE BOARD
Given this list: grades = [[85, 92, 88], [78, 86, 90], [90, 95, 88]]

Find the average of each list.

for student_grades in grades:

    total_grade = sum(student_grades)

    average_grade = total_grade / len(student_grades)

    print(average_grade)

300

 The output of this statement :

X = True, Y = False

if (not (X or Y) or Y) : print(1)

else: print (2)

What is 2

300

The letters i,j that create the split in this word from "Coding is fun!" to is 


word[i:j] = "Coding is fun!"

What is 7,9

300

def A():

return "apple"

def B():

s = A().replace("a","gra")

return s

print(B())

What is grapple.

400

Guess the output

for i in range(1, 4):

    for j in range(1, 4):

        print(i * j, end=" ")

    print()

What is 

1 2 3 

2 4 6 

3 6 9 

400

DRAW ON THE BOARD
Create a function to calculate the sum of all the elements in a 2D list. For instance, given [[1, 2], [3, 4], [5, 6]], the function should return 21.

def sum_2d_list(matrix):

    total = 0

    for row in matrix:

        for element in row:

            total += element

    return total

400

Guess the Output 

a = 7

if a > 5:

    if a > 10:

        print("A")

    else:

        print("B")

else:

    print("C")



What is B

400

The function add to this word to take it from "###hi###" to "hi"

What is word.strip('#')

400

DRAW ON THE BOARD

The the function to check if a word is a palindrome and returns true or false

def isPali(word):

for i in range(len(word)):

if(word[i] !=word[-1-i]): return false

return true 

500

DRAW ON THE BOARD
Write a Python program to count the number of even and odd numbers from a list of numbers.

def count_even_odd(numbers):

   even_count = 0

    odd_count = 0

    

    for num in numbers:

        if num % 2 == 0:

            even_count += 1

        else:

            odd_count += 1

    return even_count, odd_count


500

DRAW ON THE BOARD

The code that creates a matrix in 7 lines of code:

matrix = []

 for i in range(rows):
   row = []
   for j in range(cols):
        row.append(0)
   matrix.append(row)

500

DRAW ON THE BOARD

Write a Python program that uses conditional statements to provide a weather description. If the temperature is greater than 30, print "It's hot outside." If it's between 10 and 30 (inclusive), print "It's warm outside." Otherwise, print "It's cold outside."

temperature = int(input("Enter the temperature: "))

if temperature > 30:

    print("It's hot outside.")

elif 10 <= temperature <= 30:

    print("It's warm outside.")

else:

    print("It's cold outside.")

500

DRAW ON THE BOARD

The code to take this string " Hi! my! name! is! python! " to "Hi my name is python"

Use: Split and Join

string =  " Hi! my! name! is! python! "

string_list = string. split()

for i range(len(string_list)): string_list[i] = string_list[i].strip('!')

string = " ".join(string_list)

500

DRAW ON THE BOARD

write a function, find_duplicates, that takes a list and returns a new list containing only the duplicate elements.

def find_duplicates(input_list):

    duplicate_list = []

    for i in range(len(input_list)):

        for j in range(i + 1, len(input_list)):

            if input_list[i] == input_list[j] and input_list[i] not in duplicate_list:

                duplicate_list.append(input_list[i])

    return duplicate_list

600

DOUBLE JEOPARDY

Create a for loop that is able to find the individual numbers that comprise a numbers place value and add them to a list. (Must use %)

1234 will become [1000,200,30,4]

num=12

list =[]

for i in range(1,len(str(num))):

    list.append(num%(10**i))

list.append(10**(i))

print(list)

    

600

DOUBLE JEOPARDY

Given the matrix:

x = [ [ 2,4,5] , [6,7,8] ]

Create the code to transform  the matrix into
this order

x = [ [8,6,2], [5,7,4] ]

x = [ [ 2,4,5] , [6,7,8] ]

x[0][2],x[1][0] = x[1][0],x[0][2]

x[0][1],x[1][2] = x[1][2],x[0][1]

print(x)

600

Double Jeopardy 

x,y,z = 0,1,0

if ( (not (not x or y ) or y or x ) or y ):

    x = False

    y = True

if(not (x and y)):

    if(x):

        print(5*25%(z+20))

    elif(y):

        print(4*45%(z+25))

    else:

        print('cmon')

5

600

Given the string = 

"Aren't you glad that python is not a....  snake!"

Transform it into:

"python is a snake...."

Cannot use import.string

string ="Aren't you glad that python is not a.... snake"

list = [i.strip(" .") for i in string.split()]

list = list[4:6] +list[7:]

list.insert(3,'....')

string=" ".join(list)

print(string)

600

DOUBLE JEOPARDY 

I'm given the list of [1,2,3,4,5] 

Create a function to find my number in 2 yes ,less, or more questions every single time in this ordered list!

def finder(list):

    middle = list[len(list)//2]

    ans = str(input(f'Num {middle} '))

    if(ans=='yes'):

        return middle

    elif(ans=="less"):

        left = list[:middle]

        ans = str(input(f'Num {left[0]} '))

        if(ans =="yes"):

            return left[0]

        else:

            return left[1]

    else:

        right =list[middle+1:]

        ans = str(input(f'Num {right[0]} '))

        if(ans =="yes"):

            return right[0]

        else:

            return right[1]

print(finder([1,2,3,4,5]))