1 of 28

Problem Solutions: Lecture 14

CSCI 141 Winter 23

2 of 28

Exercises of interest

Add a + next to any Exercise(s) your team wants to have discussed as a class.

1

2

3

4 ++

Add a + next to any Problem(s) your team wants to have discussed as a class.

1 +++

2 ++++

3 +

4 ++++

5 +

6 +++

Problems of interest

3 of 28

Questions

Feel free to post any questions that come up here:

4 of 28

Problems: Team TEMPLATE

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

5 of 28

Problems: Team 28

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

def remove_vowel(string):

vowels = 'aieouAIEOU'

string = string.replace("a","")

string = string.replace("e","")

string = string.replace("i","")

string = string.replace("o","")

string = string.replace("u","")

print(string)

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

6 of 28

Problems: Team 3/4

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #

# Date:

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

location = string.find("#")

print(string.replace(string[location:], ""))

# Author: Team #

# Date:

def uun_letters(first_name, last_name):

""" Return the letters in a student's WWU Universal

Username given the student's first_name and last_name.

The username begins with the first 6 characters of

the last name, followed by the first letter of the

first name. Return the username in all lower case.

Example: uun_letters("Scott", "Wehrwein") => "wehrwes" """

new_str = ""

new_str += last_name[0:6].lower() + first_name[0].lower()

print(new_str)

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

7 of 28

Problems: Team 0

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #0

# Date: 02/17/2023

def remove_vowels(string):

""" Return string, but with all vowels removed. Don't count y as a vowel. """

string = string.replace("a", "")

string = string.replace("e", "")

string = string.replace("i", "")

string = string.replace("o", "")

string = string.replace("u", "")

return string

print(remove_vowels("hello, my name is name"))

# Author: Team #0

# Date: 02/17/2023

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

if string.find("#") != -1:

newString = string[0:string.find("#")]

return newString

else:

return string

print(remove_comments("blah blah #blahblah"))

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

8 of 28

Problems: Team 1

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

9 of 28

Problems: Team 5

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #

# Date:

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

string2=''

if int(string.find("#"))>0:

remove=int(string.find("#"))-1

string2=string[0:remove]

return string2

else:

return string

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

10 of 28

Problems: Team 7

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team 7

# Date: 2/17

def remove_vowels(string):

""" Return string, but with all vowels removed. Don't count y as a vowel. """

new = string

new = new.replace("a", "")

new = new.replace("e", "")

new = new.replace("i", "")

new = new.replace("o", "")

new = new.replace("u", "")

return new

# Author: Team 7

# Date: 2/17

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

return string[:string.find("#")]

# Author: Team 7

# Date: 2/17

def capitalize_words(string):

""" Return a copy of string, but with the first letter of each word

capitalized. Pre: string contains words made of only letters, each separated

by a single space."""

split = string.split(" ")

new = ""

for word in split:

new += word[0].upper() + word[1:] + " "

return new.strip()

# Author: Team 7

# Date: 2/17

def uun_letters(first_name, last_name):

""" Return the letters in a student's WWU Universal

Username given the student's first_name and last_name.

The username begins with the first 6 characters of

the last name, followed by the first letter of the

first name. Return the username in all lower case.

Example: uun_letters("Scott", "Wehrwein") => "wehrwes" """

return (last_name[:6] + first_name[0]).lower()

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

11 of 28

Problems: Team 8

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

def remove_vowels():

string = "abcdefhijklmnopqrstuvwxyz"

string = string.upper().replace("A", "")

string = string.upper().replace("E", "")

string = string.upper().replace("I", "")

string = string.upper().replace("O", "")

string = string.upper().replace("U", "")

print(string)

def remove_comments(s):

if s[0] == "#":

s = s.replace("#", "", 1)

return s

def capatalize_words(word):

newWord = ""

newWord += word[0].upper()

for i in range(1, len(word)):

if word[i - 1] == " ":

newWord += word[i].upper()

elif word[i] == " ":

newWord += " "

else:

newWord += word[i]

return newWord

def uun_letter(first, last):

return last.lower()[0:6] + first.lower()[0]

12 of 28

Problems: Team 10

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #10

# Date: 2/17/23

string = str(input())

def remove_vowels(string):

print(string.replace("a","").replace("e","").replace("i","").replace("o","").replace("u",""))

remove_vowels(string)

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

13 of 28

Problems: Team 13

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team 13

# Date: 2/17/23

def remove_vowels(string):

""" Return string, but with all vowels removed. Don't count y as a vowel. """

return string.replace('a','').replace('e','').replace('o','').replace('i','').replace('u','')

# Author: Team 13

# Date: 2/17/23

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

comment = string.find('#')

if comment == -1:

return string

else:

return string[0:comment]

# Author: Team 13

# Date: 2/17/23

def capitalize_words(string):

""" Return a copy of string, but with the first letter of each word

capitalized. Pre: string contains words made of only letters, each separated

by a single space."""

newstring = ''

capital = 0

for i in range(len(string)):

if i == 0:

newstring += string[i].upper()

elif string[i] == ' ':

capital = 1

newstring += ' '

elif string[i] != ' ' and capital == 1:

newstring += string[i].upper()

capital = 0

elif string[i] != ' ' and capital == 0:

newstring += string[i]

captial = 0

return newstring

# Author: Team 13

# Date: 2/17/23

def uun_letters(first_name, last_name):

""" Return the letters in a student's WWU Universal

Username given the student's first_name and last_name.

The username begins with the first 6 characters of

the last name, followed by the first letter of the

first name. Return the username in all lower case.

Example: uun_letters("Scott", "Wehrwein") => "wehrwes" """

return last_name[0:6].lower() + first_name[0].lower()

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

14 of 28

Problems: Team 14

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

print("While {} was playing in a {} he saw {} {}".format("miguel", "field", 4 ,"dogs"))

Or

print("While {name} was playing in a {place} he saw {number} {animal}".format(name = "miguel", place = "field", number = 4 , animal = "dogs"))

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #14

# Date: 17 February 2023

def remove_vowels(string):

""" Return string, but with all vowels removed. Don't count y as a vowel. """

string = string.replace('a','').replace('e','').replace('i','').replace('o','').replace('u','')

string = string.replace('A','').replace('E','').replace('I','').replace('O','').replace('U','')

return string

# Author: Team #14

# Date: 17 February 2023

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

string = string[:string.find('#')]

return string

# Author: Team #

# Date:

def capitalize_words(string):

capitalize = string.title()

return capitalize

print(capitalize_words("Cheese nuggets to capitalize"))

# Author: Team #

# Date:

def uun_letters(firstname, last_name):

user = last_name[0:6]

user += firstname[0]

return user.lower()

print (uun_letters("Scott", "Wehrwein"))

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

15 of 28

Problems: Team 15

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team # 15

# Date: 2/17/23

def remove_vowels(string):

""" Return string, but with all vowels removed.

Don't count y as a vowel. """

new = string.replace("a", "")

new = string.replace("e", "")

new = string.replace("u", "")

new = string.replace("o", "")

new = string.replace("i", "")

return new

# Author: Team # 15

# Date: 2/17/23

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

new = string[0:string.find("#")]

return new

# Author: Team #15

# Date: 2/17/23

def capitalize_words(string):

""" Return a copy of string, but with the first letter of each word

capitalized. Pre: string contains words made of only letters, each separated

by a single space."""

new = ""

for i in range(len(string)):

if string[i] == string[0]:

new = new + string[0].upper()

if string[i-1] == " ":

new = new + string[i].upper()

elif string[i] != string[0]:

new = new + string[i]

return new

# Author: Team # 15

# Date: 2/17/23

def uun_letters(first_name, last_name):

""" Return the letters in a student's WWU Universal

Username given the student's first_name and last_name.

The username begins with the first 6 characters of

the last name, followed by the first letter of the

first name. Return the username in all lower case.

Example: uun_letters("Scott", "Wehrwein") => "wehrwes" """

new = last_name[0:6] + first_name[0]

return new.lower()

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

16 of 28

Problems: Team 17

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

def capitalize_words(string):

'''Return a copy of a string, but with the first letter of each word capitalized. Pre: string contains words made of only letters, each

seperated by a single space.'''

string = string.upper()

return string

print(capitalize_words("yummy yummy"))

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

17 of 28

Problems: Team 18

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #

# Date:

def removeVowels(word):

for i in word:

if i == "a" or i == "e" or i == "i" or i == "o" or i == "u":

res = word.replace(i,"")

return res

print(removeVowels("apple"))

# Author: Team #

# Date:

def remove_comments(string):

for i in string:

if string[0] == "#":

uncommented = string.replace("#", "")

return(uncommented)

print(remove_comments("# this function does blah"))

# Author: Team #

# Date:

# Author: Team #

# Date:

def uun_letters(first_name, last_name):

for i in range(6):

print(last_name[i].lower(), end = "")

print(first_name[0].lower())

return("")

print(uun_letters("Sydney", "Campbell"))

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

18 of 28

Problems: Team 22

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #

# Date:

def remove_vowels(string):

new_string = string.casefold().replace("a","").replace("e","").replace("i","").replace("o", "").replace("u","")

return(new_string)

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

def uun_letters(first_name, last_name):

first = first_name[0]

last = last_name[0:6]

username = (last + first).lower()

return username

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

19 of 28

Problems: Team 24

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: William Lisbin Team #24

# Date:

def remove_vowel(s):

return s.replace("a", "").replace("e", "").replace("i", "").replace("o", "").replace("u", "")

print(remove_vowel("words"))

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

20 of 28

Problems: Team 25

Problem 1:

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team # 25

# Date: February 17

def remove_vowels(string):

""" Return string, but with all vowels removed. Don't count y as a vowel. """

word = string

t = word.replace("a", "").replace("e","").replace("i", "").replace("o", "").replace("u", "")

print(t)

remove_vowels("")

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

21 of 28

Problems: Team 26

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team 26

# Date: 2/17/23

def remove_vowels(string):

return_var = ""

for i in range(len(string)):

s = string[i]

if s != "a" and s != "e" and s != "i" and s != "o" and s != "u":

return_var += string[i]

return return_var

# Author: Team 26

# Date: 2/17/23

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

string2 = string.replace('#', "")

return string2

# Author: Team #26

# Date: 2/17/23

def capitalize_words(string):

""" Return a copy of string, but with the first letter of each word

capitalized. Pre: string contains words made of only letters, each separated

by a single space."""

string2 = string.capitalize()

return string2

# Author: Team 26

# Date: 2/17/23

def unn_letters(first_name, last_name):

last_name = last_name.lower().strip()

first_name = first_name.lower().strip()

first_name = first_name[0]

last_name = last_name[:6]

wwu_id = last_name + first_name

return wwu_id

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

exclamation = str(input("Type an exclamation: "))

adverb = str(input("Type an adverb: "))

noun = str(input("Type a noun: "))

adjective = str(input("Type an adjective: "))

print(exclamation + "!","he said", adverb, "as he jumped into his convertible", noun, "and drove off with his", adjective, "wife.",end = "")

22 of 28

Problems: Team 27

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #27

# Date: 2/17/23

def remove_vowels(string):

change = string.replace("a", "")

change = change.replace("e", "")

change = change.replace("i", "")

change = change.replace("o", "")

change = change.replace("u", "")

return change

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

23 of 28

Problems: Team 29

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #29

# Date: 2/17/23

def remove_vowels(string):

return string.replace("A", "").replace("a", "").replace("E", "").replace("e", "").replace("I", "").replace("i", "").replace("O", "").replace("o", "").replace("U", "").replace("u", "")

# Author: Team #29

# Date: 2/17/23

def remove_comments(string):

cat = string.find("#")

return string[:cat]

# Author: Team #

# Date:

# Author: Team #29

# Date: 2/17/23

def uun_letters(first_name, last_name):

cat = ""

cat += last_name[:6]

cat += first_name[0]

return cat.lower()

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

24 of 28

Problems: Team 30

#1

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #

# Date:

import re

def replaceVowels(test_str, v):

vowels = 'AEIOUaeiou'

return re.sub(rf'[{vowels}]', v, test_str)

input_str = "Computer Science 141"

v = ""

print("newstring:",

replaceVowels(input_str, v))

#Team: 30

#Date: 2/17/2023

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

return string.replace("#","")

# Author: Team # 30

# Date: Feb 17 2023

def capitalize_words(s):

return ' '.join(word.capitalize() for word in s.split())

s = 'computer science 141'

new_s = capitalize_words(s)

print(new_s)

#Team: 30

#Date: 2/17/2023

def uun_letters(first_name, last_name):

""" Return the letters in a student's WWU Universal

Username given the student's first_name and last_name.

The username begins with the first 6 characters of

the last name, followed by the first letter of the

first name. Return the username in all lower case.

Example: uun_letters("Scott", "Wehrwein") => "wehrwes" """

first=last_name[0:6]

last=first_name[0:1]

username= first+last

return username

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

25 of 28

Problems: Team 31

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #

# Date:

def remove(string):

"""Takes a string and removes the vowels

precondition: string must be lowercase"""

s = string.lower().replace("a", "")

b = s.lower().replace("e","")

c = b.lower().replace("i","")

d = c.lower().replace("o","")

e = d.lower().replace("u","")

print(e)

remove("bollywood")

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

26 of 28

Problems: Team 37

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #37

# Date: 02/17/2023

def remove_comments(string):

if ("#" in string) == True:

string = ""

return string

# Author: Team #37

# Date: 02/17/2023

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

# Author: Team #37

# Date: 2/17/2023

def uun_letters(first_name, last_name):

print(last_name[:6].lower(), first_name[0].lower(), sep="")

uun_letters("", "")

# Author: Team #37

# Date: 2/17/2023

def remove_vowels(string):

# return string.replace(vowels, "")

return string.replace("a", "").replace("A", "").replace("e", "").replace("E", "").replace("i", "").replace("I", "").replace("o", "").replace("O", "").replace("u", "").replace("U", "")

print(remove_vowels("jimmy"))

27 of 28

Problems: Team 38

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #38

# Date: 2/17/23

def remove_vowels(string):

""" Return string, but with all vowels removed. Don't count y as a vowel. """

string = string.replace("a", "").replace("e", "").replace("i", "").replace("o", "").replace("u", "")

return string

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date:

28 of 28

Problems: Team 40

Problem 1: Write your code below.

Problem 2: Write your code below.

Problem 4: Write your code below.

Problem 3: Write your code below.

Problem 5: Write your code below.

Develop and test your solutions in Thonny and paste each program here when it’s done. Rearrange this slide or make a new one as needed to make room.

# Author: Team #40

# Date: 02/17/2023

def remove_vowels(string):

""" Return string with all vowels removed (excluding y)"""

for i in "aeiouAEIOU":

string = string.replace(i, "")

return string

# Author: Team #

# Date:

# Author: Team #

# Date:

# Author: Team #

# Date:

def remove_comments(string):

""" Return a copy of string, but with all characters starting with and following

the first instance of ‘#’ removed. If there is no # in the string, return

the input unchanged."""

n = string.find("#")

return string[0:n]

If you get to Problem 6, create a second slide and put it there.

# Author: Team #

# Date: