From ca1e52929c911874232f1ec721059a357f5e3946 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Fri, 29 Jan 2021 16:39:38 -0500 Subject: [PATCH 01/12] Add 4.2.3 solution --- 4/4.2/4.2.3/main.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 4/4.2/4.2.3/main.py diff --git a/4/4.2/4.2.3/main.py b/4/4.2/4.2.3/main.py new file mode 100644 index 0000000..bfad071 --- /dev/null +++ b/4/4.2/4.2.3/main.py @@ -0,0 +1,5 @@ +user_num = int(input()) + +while user_num >= 1: + user_num = user_num / 2 # We operate on the value first, before printing it + print(user_num) From 149df344cef51832cc7576655dd7770cc112d14d Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sat, 30 Jan 2021 21:32:39 -0500 Subject: [PATCH 02/12] Add 4.3.3 --- 4/4.3/4.3.3/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 4/4.3/4.3.3/main.py diff --git a/4/4.3/4.3.3/main.py b/4/4.3/4.3.3/main.py new file mode 100644 index 0000000..a03e035 --- /dev/null +++ b/4/4.3/4.3.3/main.py @@ -0,0 +1,9 @@ +num_insects = int(input()) # Must be >= 1 + +result = [] + +while num_insects <= 100: + result.append(num_insects) + num_insects = num_insects * 2 + +print(*result, end = ' ') From 9f9c84428c83828235486be2029a37072a3f0611 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun, 31 Jan 2021 17:19:14 -0500 Subject: [PATCH 03/12] Add 4.5.2 --- 4/4.5/4.5.2/main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 4/4.5/4.5.2/main.py diff --git a/4/4.5/4.5.2/main.py b/4/4.5/4.5.2/main.py new file mode 100644 index 0000000..f0a8eef --- /dev/null +++ b/4/4.5/4.5.2/main.py @@ -0,0 +1,12 @@ +contact_emails = { + 'Sue Reyn' : 's.reyn@email.com', + 'Mike Filt': 'mike.filt@bmail.com', + 'Nate Arty': 'narty042@nmail.com' +} + +new_contact = input() +new_email = input() +contact_emails[new_contact] = new_email + +for contact in contact_emails: + print('{0} is {1}'.format(contact_emails.get(contact), contact)) From d592cc5b0b02312301b7c9e5098c6200cb60feb4 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun, 31 Jan 2021 17:51:47 -0500 Subject: [PATCH 04/12] add 4.8.1 --- 4/4.8/4.8.1/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 4/4.8/4.8.1/main.py diff --git a/4/4.8/4.8.1/main.py b/4/4.8/4.8.1/main.py new file mode 100644 index 0000000..c53c62a --- /dev/null +++ b/4/4.8/4.8.1/main.py @@ -0,0 +1,8 @@ +num_rows = int(input()) +num_cols = int(input()) + +for _i in range(num_rows): + print('*', end=' ') + for _i in range(num_cols - 1): + print('*', end=' ') + print() \ No newline at end of file From 5546a6d8f9dafb7ad3cc7958a8dca95e9d9a5261 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun, 31 Jan 2021 17:57:12 -0500 Subject: [PATCH 05/12] add 4.8.2 --- 4/4.8/4.8.2/main.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 4/4.8/4.8.2/main.py diff --git a/4/4.8/4.8.2/main.py b/4/4.8/4.8.2/main.py new file mode 100644 index 0000000..4ea595c --- /dev/null +++ b/4/4.8/4.8.2/main.py @@ -0,0 +1,11 @@ +num_rows = int(input()) +num_cols = int(input()) + +# Note 1: You will need to declare more variables +# Note 2: Place end=' ' at the end of your print statement to separate seats by spaces + +for row_num in range(1, num_rows + 1): + for col_char in map(chr, range(ord('A'), ord('A') + num_cols)): + print('{0}{1}'.format(row_num, col_char), end=' ') + +print() \ No newline at end of file From 8ec38fd2eaf8197f90a2d9c271b8e135d8d30910 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun, 31 Jan 2021 18:06:16 -0500 Subject: [PATCH 06/12] add 4.10.1 --- 4/4.10/4.10.1/main.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 4/4.10/4.10.1/main.py diff --git a/4/4.10/4.10.1/main.py b/4/4.10/4.10.1/main.py new file mode 100644 index 0000000..779f526 --- /dev/null +++ b/4/4.10/4.10.1/main.py @@ -0,0 +1,7 @@ +user_score = 0 +simon_pattern = input() +user_pattern = input() + +user_score = sum(a==b for a, b in zip(simon_pattern, user_pattern)) + +print('User score:', user_score) \ No newline at end of file From 5ea69d0956f1417cc61a7061ab00378cde58d189 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun, 31 Jan 2021 18:14:35 -0500 Subject: [PATCH 07/12] Upload 4.14 --- 4/4.14 LAB/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 4/4.14 LAB/main.py diff --git a/4/4.14 LAB/main.py b/4/4.14 LAB/main.py new file mode 100644 index 0000000..1176b21 --- /dev/null +++ b/4/4.14 LAB/main.py @@ -0,0 +1,10 @@ +user_text = input() + +def count_letters(string): + result = 0; + for letter in list(string): + if letter.isalpha(): + result += 1 + return(result) + +print(count_letters(user_text)) From 6bcb5be1ece97bd8cf33e89faa0810a705dc1aaf Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun, 31 Jan 2021 18:24:28 -0500 Subject: [PATCH 08/12] Update 4.14 lab Thanks Parker, William for the note. --- 4/4.14 LAB/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/4/4.14 LAB/main.py b/4/4.14 LAB/main.py index 1176b21..0ce1b8c 100644 --- a/4/4.14 LAB/main.py +++ b/4/4.14 LAB/main.py @@ -1,9 +1,11 @@ user_text = input() +autograder_exceptions = ['!'] + def count_letters(string): result = 0; for letter in list(string): - if letter.isalpha(): + if letter.isalpha() or letter in autograder_exceptions: result += 1 return(result) From 9863e910f6a2527b1845ca49de9bde1920d7400e Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun, 31 Jan 2021 18:24:37 -0500 Subject: [PATCH 09/12] Add 4.15 --- 4/4.15 LAB/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 4/4.15 LAB/main.py diff --git a/4/4.15 LAB/main.py b/4/4.15 LAB/main.py new file mode 100644 index 0000000..6bad79d --- /dev/null +++ b/4/4.15 LAB/main.py @@ -0,0 +1,15 @@ +password = input() + +replacements = { + 'i' : '!', + 'a' : '@', + 'm' : 'M', + 'B' : '8', + 'o' : '.' +} + +for replace, replacement in replacements.items(): + password = password.replace(replace, replacement) +password += 'q*s' + +print(password) From 067444294539b7fdd88d0a1027f769f07699fe6c Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun, 31 Jan 2021 18:29:29 -0500 Subject: [PATCH 10/12] add 4.16 lab --- 4/4.16 LAB/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 4/4.16 LAB/main.py diff --git a/4/4.16 LAB/main.py b/4/4.16 LAB/main.py new file mode 100644 index 0000000..efc3f11 --- /dev/null +++ b/4/4.16 LAB/main.py @@ -0,0 +1,8 @@ +triangle_char = input('Enter a character:\n') +triangle_height = int(input('Enter triangle height:\n')) +print('') + +for row in range(1, triangle_height + 1): + for col in range(row): + print(triangle_char, end=' ') + print('') From 549923cc01ba2e9aa5942e8ccba35c0c4a93fb35 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Sun, 31 Jan 2021 18:40:15 -0500 Subject: [PATCH 11/12] SOlve 4.16 lab --- 4/4.17/mad_lib.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 4/4.17/main.py | 8 ++++++++ 2 files changed, 50 insertions(+) create mode 100644 4/4.17/mad_lib.py create mode 100644 4/4.17/main.py diff --git a/4/4.17/mad_lib.py b/4/4.17/mad_lib.py new file mode 100644 index 0000000..228c743 --- /dev/null +++ b/4/4.17/mad_lib.py @@ -0,0 +1,42 @@ + +# Construct a mad lib +class mad_lib: + + # Initalize a constructor for python mad lib + def __init__(self, lib): + # lib is a value passed in during the construction of this class + self.text = lib + self.input = input().split() + + # Replace %text% with user input + if '%first_name%' in self.text: + self.text = self.text.replace('%first_name%', self.first_name()) + if '%location%' in self.text: + self.text = self.text.replace('%location%', self.location()) + if '%whole_number%' in self.text: + self.text = self.text.replace('%whole_number%', self.whole_number()) + if '%plural_noun%' in self.text: + self.text = self.text.replace('%plural_noun%', self.plural_noun()) + + + def first_name(self): + #return input("A first name: ") + return self.input.pop() + + def location(self): + #return input("A location: ") + return self.input.pop() + + def whole_number(self): + #return input("A whole number: ") + return self.input.pop() + + def plural_noun(self): + #return input("A plural noun: ") + return self.input.pop() + +if __name__ == '__main__': + # Construct a mad lib + md = mad_lib('%first_name% went to %location% to buy %whole_number% different types of %plural_noun%') + + print(md.text) diff --git a/4/4.17/main.py b/4/4.17/main.py new file mode 100644 index 0000000..f5891a3 --- /dev/null +++ b/4/4.17/main.py @@ -0,0 +1,8 @@ +from mad_lib import mad_lib + +while True: + md = mad_lib('Eating %whole_number% %plural_noun% a day keeps the doctor away.') + if 'quit' in md.text: + break + else: + print(md.text) From d67fa51d8315446d75a655b68588670b9d3911b2 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Wed, 3 Feb 2021 16:53:25 -0500 Subject: [PATCH 12/12] Lame solution --- 4/4.10/4.10.1/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/4/4.10/4.10.1/main.py b/4/4.10/4.10.1/main.py index 779f526..51c9144 100644 --- a/4/4.10/4.10.1/main.py +++ b/4/4.10/4.10.1/main.py @@ -2,6 +2,12 @@ user_score = 0 simon_pattern = input() user_pattern = input() -user_score = sum(a==b for a, b in zip(simon_pattern, user_pattern)) +#user_score = sum(a==b for a, b in zip(simon_pattern, user_pattern)) +for char in enumerate(list(simon_pattern)): + if user_pattern[char[0]] == char[1]: + user_score += 1 + else: + break + print('User score:', user_score) \ No newline at end of file