From 13d7f7a393542c0ce035f3af893a1f6757d3bd62 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Mon, 8 Feb 2021 10:24:17 -0600 Subject: [PATCH 01/24] Update and rename codedamn9.py to script.py --- codedamn9.py | 28 ---------------------------- script.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 28 deletions(-) delete mode 100644 codedamn9.py create mode 100644 script.py diff --git a/codedamn9.py b/codedamn9.py deleted file mode 100644 index 9846dbf..0000000 --- a/codedamn9.py +++ /dev/null @@ -1,28 +0,0 @@ - - - -""" -9) for loop -""" - - -word = "CatMat" - - -# run a for loop on word -# finish the code to print out each letter, one at a time -for i in : - print() - - - - - - -def main(): - pass - - - -if __name__ == "__main__": - main() diff --git a/script.py b/script.py new file mode 100644 index 0000000..d31f7c1 --- /dev/null +++ b/script.py @@ -0,0 +1,38 @@ + + + +""" +4) Index and Slicing + +""" + +word = "CatMat" + +first = # assign the first letter of word with indexing +third = # assign the third letter of word with indexing +f_3 = # assign the first three letters word with slicing + + + + + + + +def main(): + if first == "C": + print(f"first: passed test, got {first}, expected C") + else: + print(f"first: failed test, got {first}, expected C") + if third == "t": + print(f"third: passed test, got {third}, expected t") + else: + print(f"third: failed test, got {third}, expected t") + if f_3 == "Cat": + print(f"f_3: passed test, got {f_3}, expected Cat") + else: + print(f"f_3: failed test, got {f_3}, expected Cat") + + + +if __name__ == "__main__": + main() From 0d2b9373c166936f60f3583cf50fc4f22b95ef01 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Mon, 8 Feb 2021 10:31:56 -0600 Subject: [PATCH 02/24] Update script.py --- script.py | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/script.py b/script.py index d31f7c1..5bc4b98 100644 --- a/script.py +++ b/script.py @@ -1,17 +1,17 @@ - """ -4) Index and Slicing +7) syntax/variable rules """ -word = "CatMat" +# fix what's wrong + +4_test = 5 -first = # assign the first letter of word with indexing -third = # assign the third letter of word with indexing -f_3 = # assign the first three letters word with slicing +print("hello) +test 1 = 97 @@ -19,18 +19,7 @@ def main(): - if first == "C": - print(f"first: passed test, got {first}, expected C") - else: - print(f"first: failed test, got {first}, expected C") - if third == "t": - print(f"third: passed test, got {third}, expected t") - else: - print(f"third: failed test, got {third}, expected t") - if f_3 == "Cat": - print(f"f_3: passed test, got {f_3}, expected Cat") - else: - print(f"f_3: failed test, got {f_3}, expected Cat") + pass From 0e502793febb683e477317f92c7c1bd91d765b7f Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Wed, 10 Feb 2021 19:47:29 -0600 Subject: [PATCH 03/24] Update script.py --- script.py | 1 - 1 file changed, 1 deletion(-) diff --git a/script.py b/script.py index 5bc4b98..db81e8f 100644 --- a/script.py +++ b/script.py @@ -17,7 +17,6 @@ - def main(): pass From 8303df5768390535ccb1b33d9d72d77b37c6bee6 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Wed, 10 Feb 2021 19:47:48 -0600 Subject: [PATCH 04/24] Update script.py --- script.py | 1 - 1 file changed, 1 deletion(-) diff --git a/script.py b/script.py index db81e8f..6f5983a 100644 --- a/script.py +++ b/script.py @@ -2,7 +2,6 @@ """ 7) syntax/variable rules - """ # fix what's wrong From 952fd6cf04ef0f1cc15db3a4aca60c1d3e345bd1 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:19:15 -0600 Subject: [PATCH 05/24] Delete codedamn10.py --- codedamn10.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 codedamn10.py diff --git a/codedamn10.py b/codedamn10.py deleted file mode 100644 index 98ac789..0000000 --- a/codedamn10.py +++ /dev/null @@ -1,25 +0,0 @@ - - -""" -10) custom function - -""" - - - -# Finish the function that prints out your name - -def name(): - - - - - - -def main(): - name() - - - -if __name__ == "__main__": - main() From 519c58a2058c6c22752d796366942937e2b237e7 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:20:07 -0600 Subject: [PATCH 06/24] Delete codedamn11.py --- codedamn11.py | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 codedamn11.py diff --git a/codedamn11.py b/codedamn11.py deleted file mode 100644 index a4ad4a9..0000000 --- a/codedamn11.py +++ /dev/null @@ -1,22 +0,0 @@ - - - -""" -11) function and docstring - - -""" - -# create a function goodbye that prints out "goodbye" -# and has a docstring - - - - -def main(): - goodbye() - - - -if __name__ == "__main__": - main() From d5974015a703050a27dac89dfe61de675266c9e6 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:20:14 -0600 Subject: [PATCH 07/24] Delete codedamn13.py --- codedamn13.py | 54 --------------------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 codedamn13.py diff --git a/codedamn13.py b/codedamn13.py deleted file mode 100644 index d553eb2..0000000 --- a/codedamn13.py +++ /dev/null @@ -1,54 +0,0 @@ - -""" -13) Booleans conditions - - -""" - -# make the following eqivalent - -""" -eg. - -test = 4 != 3 # I made test Test 4 don't equal 3 -""" - - -no = 1 == # finish equivalence making no True - -nope = 3 != # finish equivalence making nope False - -maybe = 5 >= # finish equivalence making maybe True - - - - - - - - - - - - - - - -def main(): - if no == True: - print(f"no: passed test, got {no}, expected True") - else: - print(f"no: failed test, got {no}, expected True") - if nope == False: - print(f"nope: passed test, got {nope}, expected False") - else: - print(f"nope: failed test, got {nope}, expected False") - if maybe == True: - print(f"maybe: passed test, got {maybe}, expected True") - else: - print(f"maybe: failed test, got {maybe}, expected True") - - - -if __name__ == "__main__": - main() From 8652b2280d26db13489e890ad27b20af74088074 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:20:20 -0600 Subject: [PATCH 08/24] Delete codedamn14.py --- codedamn14.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 codedamn14.py diff --git a/codedamn14.py b/codedamn14.py deleted file mode 100644 index b3fa7aa..0000000 --- a/codedamn14.py +++ /dev/null @@ -1,38 +0,0 @@ - -""" -14) reassign increment inplace - -""" - - -x = 4 - -x = x # make x equal 10 - -new = x # new equal 8 - -new new # use incrementing to increase new to 10 - -new new # use decrementing to decrease new to 5 - - - - - - - - -def main(): - if x == 10: - print(f"x: passed test, got {x}, expected 10") - else: - print(f"x: failed test, got {x}, expected 10") - if new == 5: - print(f"new: passed test, got {new}, expected 5") - else: - print(f"new: failed test, got {new}, expected 5") - - - -if __name__ == "__main__": - main() From 29a5cd8aedc3fd579c3e033d2763b9a3cc92c128 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:20:40 -0600 Subject: [PATCH 09/24] Delete codedamn15.py --- codedamn15.py | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 codedamn15.py diff --git a/codedamn15.py b/codedamn15.py deleted file mode 100644 index e56a38a..0000000 --- a/codedamn15.py +++ /dev/null @@ -1,39 +0,0 @@ - - -""" -15) while loop - -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 -0 print out like this -""" - -x = 10 - -# count down from 10 to 0, just like the example above -# fill in the head state with a condition -# fill in the body, you need two lines one to change value -# and eon to print - -while : - - - - - - -def main(): - pass - - - -if __name__ == "__main__": - main() From dff7e7f23aa0fddf12cb2569bfbded1e4e7e0760 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:20:50 -0600 Subject: [PATCH 10/24] Delete codedamn16.py --- codedamn16.py | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 codedamn16.py diff --git a/codedamn16.py b/codedamn16.py deleted file mode 100644 index dddf2f6..0000000 --- a/codedamn16.py +++ /dev/null @@ -1,31 +0,0 @@ - - -""" -16) if / else - -""" - -# write an if / else if the following numbers are less than 10 -# uncomment one at a time to test your condition - -x = 11 -##x = 12 -##x = 8 - -if : # finish by writing condition here - print(f"Yes {x} is less than 10") -else: - print(f"no {x} is not less than 10") - - - - - - -def main(): - pass - - - -if __name__ == "__main__": - main() From e9d01c421eb2fa1f8355a29ad35f5195d48de762 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:20:58 -0600 Subject: [PATCH 11/24] Delete codedamn17.py --- codedamn17.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 codedamn17.py diff --git a/codedamn17.py b/codedamn17.py deleted file mode 100644 index c765b42..0000000 --- a/codedamn17.py +++ /dev/null @@ -1,35 +0,0 @@ - -""" -17) modulo operator - - -eg. r_1 = 3 % 2 # to assign a remainder of 1 -""" - -r_2 = 5 % # enter a number to assign a remainder of 2 - -r_5 = 11 % # enter a number to assign a remainder of 5 - -r_3 = 10 % # enter a number to assign a remainder of 3 - - - -def main(): - if r_2 == 2: - print(f"r_2: passed test, got {r_2} expected 2") - else: - print(f"r_2: failed test, got {r_2} expected 2 ") - if r_5 == 5: - print(f"r_5: passed test, got {r_5} expected 5") - else: - print(f"r_5: failed test, got {r_5} expected 5") - if r_3 == 3: - print(f"r_3: passed test, got {r_3} expected 3") - else: - print(f"r_3: failed test, got {r_3} expected 3") - - - - -if __name__ == "__main__": - main() From 77bca94fde19d12c479af56edb5c20899b628f85 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:21:04 -0600 Subject: [PATCH 12/24] Delete codedamn18.py --- codedamn18.py | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 codedamn18.py diff --git a/codedamn18.py b/codedamn18.py deleted file mode 100644 index e291b62..0000000 --- a/codedamn18.py +++ /dev/null @@ -1,27 +0,0 @@ - - -""" -18) for loop - -iterate through list - - -""" - -grades = [81,76,96,93,95,100] - - -# write a for loop on grade that prints out if they are divisable by 3 -# code below - - - - - -def main(): - pass - - - -if __name__ == "__main__": - main() From 4b95ba82cecf1d0f04bea0cd6b31d1691026521b Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:21:15 -0600 Subject: [PATCH 13/24] Delete codedamn19.py --- codedamn19.py | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 codedamn19.py diff --git a/codedamn19.py b/codedamn19.py deleted file mode 100644 index 1bb35ee..0000000 --- a/codedamn19.py +++ /dev/null @@ -1,28 +0,0 @@ - - - - -""" -20) wrap previous for loop in function - - -""" - -grades = [81,76,96,93,95,100] - - -def divisable_by_3(l): - # write code below - - - - - - -def main(): - divisable_by_3(grades) - - - -if __name__ == "__main__": - main() From 70590cdaf63e8540f31e1132a20ebd1528866aae Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:21:22 -0600 Subject: [PATCH 14/24] Delete codedamn2.py --- codedamn2.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 codedamn2.py diff --git a/codedamn2.py b/codedamn2.py deleted file mode 100644 index 534bbee..0000000 --- a/codedamn2.py +++ /dev/null @@ -1,41 +0,0 @@ - - - -"""2) variables types - -three type assignment""" - -# assign the following types - - - -name = # str -- string - -age = # int -- integer - -decimal = # float -- float - - - - - - - - - -def main(): - if type(name) == str: - print(f"{name} passed test") - else: - print(f"{name}: failed test") - if type(age) == int: - print(f"{age}: passed test") - else: - print(f"{age}: failed test") - if type(decimal) == float: - print(f"{decimal}: passed test") - else: - print(f"{decimal}: failed test") - -if __name__ == "__main__": - main() From c9e919b330384f71b967d769706f2cb368b9d538 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:21:30 -0600 Subject: [PATCH 15/24] Delete codedamn20.py --- codedamn20.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 codedamn20.py diff --git a/codedamn20.py b/codedamn20.py deleted file mode 100644 index b3411f1..0000000 --- a/codedamn20.py +++ /dev/null @@ -1,35 +0,0 @@ - -""" - -21) range function - -3 -6 -9 -12 -15 -18 create a print out like this -""" - -# use a for loop and range function to create a print out like above -# code below - - - - - - - - - - - - - -def main(): - pass - - - -if __name__ == "__main__": - main() From 50d8bf330fe004d52728f1236989c38642061efb Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:21:36 -0600 Subject: [PATCH 16/24] Delete codedamn21.py --- codedamn21.py | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 codedamn21.py diff --git a/codedamn21.py b/codedamn21.py deleted file mode 100644 index 1f5e25f..0000000 --- a/codedamn21.py +++ /dev/null @@ -1,45 +0,0 @@ - -""" -21) slicing with step - - -""" - - - -letters = "abcdefghijk" - - -every_other = # assign every other letter from letters - -every_third = # assign every 3rd letter from letters - -first_3_every_other = # assign the three letter everyother 1 eg. ace - - - - - - - - - - -def main(): - if every_other == "acegik": - print(f"every_other: passed test, got {every_other} expected acegik") - else: - print(f"every_other: failed test, got {every_other} expected acegik") - if every_third == "adgj": - print(f"every_third: passed test, got {every_third} expected acegik") - else: - print(f"every_other: failed test, got {every_third} expected acegik") - if first_3_every_other == "ace": - print(f"every_other: passed test, got {first_3_every_other} expected acegik") - else: - print(f"first_3_every_other: failed test, got {first_3_every_other} expected acegik") - - - -if __name__ == "__main__": - main() From 2fa13608e8e1b1ac5baca2a62728695d763aa134 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:21:42 -0600 Subject: [PATCH 17/24] Delete codedamn22.py --- codedamn22.py | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 codedamn22.py diff --git a/codedamn22.py b/codedamn22.py deleted file mode 100644 index 53247ba..0000000 --- a/codedamn22.py +++ /dev/null @@ -1,30 +0,0 @@ - - -""" -22) input function - -""" - -# use an input function to ask for someones name and run srcipt - - -name = - - -print(f"Hi {name} nice to meet you") - - - - - - -def main(): - if len(name) > 0 and name.isalpha(): - print("name: passed test") - else: - print("name: failed test\nplease try again") - - - -if __name__ == "__main__": - main() From c4219022a16dfaee9f8b6ee21af273ee125fbcc7 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:21:50 -0600 Subject: [PATCH 18/24] Delete codedamn23.py --- codedamn23.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 codedamn23.py diff --git a/codedamn23.py b/codedamn23.py deleted file mode 100644 index 93f1681..0000000 --- a/codedamn23.py +++ /dev/null @@ -1,34 +0,0 @@ - - -""" -23) input modules - -""" - - -# import the sys module - - - - - - - - - - - - - - -def main(): - try: - print(dir(sys)) - print("\nNice work!") - except: - print("Ooops, somethings wrong. Please try again") - - - -if __name__ == "__main__": - main() From 54abab60d223bd9115da615cdf3bc4a9879d0750 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:21:56 -0600 Subject: [PATCH 19/24] Delete codedamn3.py --- codedamn3.py | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 codedamn3.py diff --git a/codedamn3.py b/codedamn3.py deleted file mode 100644 index 737aef6..0000000 --- a/codedamn3.py +++ /dev/null @@ -1,39 +0,0 @@ - - -""" -3) operators - -""" - -x = 2 -y= 26 -z = 4 - -m = # multiply y by 17 -d = # add 14 to z -t = # subtract 12 from x - - - - - - - - - -def main(): - if m == 442: - print(f"m passed test, got {m} expected 442") - else: - print(f"m failed test, got {m} expected 442") - if d == 18: - print(f"d passed test, got {d} expected 18") - else: - print(f"d failed test, got {d} expected 18") - if t == -10: - print(f"t passed test, got {t} expected -10") - else: - print("t failed test, got {t} expected -10") - -if __name__ == "__main__": - main() From 3f6bc721fe1a6920b3a0eecccbd1d954997e86f0 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:22:05 -0600 Subject: [PATCH 20/24] Delete codedamn4.py --- codedamn4.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 codedamn4.py diff --git a/codedamn4.py b/codedamn4.py deleted file mode 100644 index d773e3f..0000000 --- a/codedamn4.py +++ /dev/null @@ -1,37 +0,0 @@ - - -""" -4) Index and Slicing - -""" - -word = "CatMat" - -first = # assign the first letter of word with indexing -third = # assign the third letter of word with indexing -f_3 = # assign the first three letters word with slicing - - - - - - - -def main(): - if first == "C": - print(f"first: passed test, got {first}, expected C") - else: - print(f"first: failed test, got {first}, expected C") - if third == "t": - print(f"third: passed test, got {third}, expected t") - else: - print(f"third: failed test, got {third}, expected t") - if f_3 == "Cat": - print(f"f_3: passed test, got {f_3}, expected Cat") - else: - print(f"f_3: failed test, got {f_3}, expected Cat") - - - -if __name__ == "__main__": - main() From ba02a264033986daebd64e874218ce7a0201fd21 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:22:12 -0600 Subject: [PATCH 21/24] Delete codedamn7.py --- codedamn7.py | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 codedamn7.py diff --git a/codedamn7.py b/codedamn7.py deleted file mode 100644 index 5bc4b98..0000000 --- a/codedamn7.py +++ /dev/null @@ -1,27 +0,0 @@ - - -""" -7) syntax/variable rules - -""" - -# fix what's wrong - -4_test = 5 - -print("hello) - -test 1 = 97 - - - - - - -def main(): - pass - - - -if __name__ == "__main__": - main() From 9371192c9b4742619d0b4b11030ce16ac3a3c5db Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Wed, 7 Apr 2021 23:05:11 -0500 Subject: [PATCH 22/24] Update script.py --- script.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/script.py b/script.py index 6f5983a..e2f1b28 100644 --- a/script.py +++ b/script.py @@ -13,13 +13,3 @@ test 1 = 97 - - - -def main(): - pass - - - -if __name__ == "__main__": - main() From 0b50b55f26b7175a423c576aa2222edbcd4fdda6 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Wed, 7 Apr 2021 23:17:23 -0500 Subject: [PATCH 23/24] Update script.py --- script.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script.py b/script.py index e2f1b28..f209ea1 100644 --- a/script.py +++ b/script.py @@ -6,10 +6,10 @@ # fix what's wrong -4_test = 5 +4_test = 5 # remove the 4_ -print("hello) +print("hello) # close the string -test 1 = 97 +test 1 = 97 # add a _ From 1824394fe46cfed1966ba9cb7c4fe6fcc5f86372 Mon Sep 17 00:00:00 2001 From: Sam <30647159+Python-basics@users.noreply.github.com> Date: Wed, 28 Apr 2021 13:30:30 -0500 Subject: [PATCH 24/24] Update script.py --- script.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.py b/script.py index f209ea1..1cc2708 100644 --- a/script.py +++ b/script.py @@ -1,7 +1,7 @@ """ -7) syntax/variable rules +syntax/variable rules """ # fix what's wrong