commit 224966a158df5a937086514c2404cef6d993084c Author: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Fri Jan 8 20:28:11 2021 -0500 Init to comit it. Messy and in need of PR! diff --git a/1.9_Mad_Lib/mad_lib/__main__.py b/1.9_Mad_Lib/mad_lib/__main__.py new file mode 100644 index 0000000..e69de29 diff --git a/1.9_Mad_Lib/mad_lib/mad_lib.py b/1.9_Mad_Lib/mad_lib/mad_lib.py new file mode 100644 index 0000000..8a2b393 --- /dev/null +++ b/1.9_Mad_Lib/mad_lib/mad_lib.py @@ -0,0 +1,33 @@ + +# Construct a mad lib +class mad_lib: + + def __init__(self, lib): + self.text = lib + self.text = self.text.replace('%first_name%', self.first_name()) + self.text = self.text.replace('%location%', self.location()) + self.text = self.text.replace('%whole_number%', self.whole_number()) + self.text = self.text.replace('%plural_noun%', self.plural_noun()) + + + def first_name(self): + #return input("A first name: ") + return input() + + def location(self): + #return input("A location: ") + return input() + + def whole_number(self): + #return input("A whole number: ") + return input() + + def plural_noun(self): + #return input("A plural noun: ") + return input() + + +# Construct a mad lib +md = mad_lib('%first_name% went to %location% to buy %whole_number% different types of %plural_noun%') + +print(md.text) \ No newline at end of file diff --git a/1.9_Mad_Lib/tests/__init__.py b/1.9_Mad_Lib/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/1.9_Mad_Lib/tests/__pycache__/__init__.cpython-37.pyc b/1.9_Mad_Lib/tests/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..029e747 Binary files /dev/null and b/1.9_Mad_Lib/tests/__pycache__/__init__.cpython-37.pyc differ diff --git a/1.9_Mad_Lib/tests/__pycache__/test_zyBooks.cpython-37.pyc b/1.9_Mad_Lib/tests/__pycache__/test_zyBooks.cpython-37.pyc new file mode 100644 index 0000000..19b4f0e Binary files /dev/null and b/1.9_Mad_Lib/tests/__pycache__/test_zyBooks.cpython-37.pyc differ diff --git a/1.9_Mad_Lib/tests/test_zyBooks.py b/1.9_Mad_Lib/tests/test_zyBooks.py new file mode 100644 index 0000000..6a73dbd --- /dev/null +++ b/1.9_Mad_Lib/tests/test_zyBooks.py @@ -0,0 +1,19 @@ +import unittest +from unittest.mock import patch +import mad_lib + + +class zyBooks_Test(unittest.TestCase): + + + + + @patch('builtins.input', return_value=['Eric', 'Chipotle', '12', 'cars']) + def test_zyBooks(self, mock_input): + result = mad_lib() + + self.assertEqual(result, 6) + + +if __name__ == '__main__': + unittest.main() diff --git a/1/23/main.py b/1/23/main.py new file mode 100644 index 0000000..0573569 --- /dev/null +++ b/1/23/main.py @@ -0,0 +1,19 @@ +user_int = 0 + +while user_int not in range(32, 126): + user_int = int(input('Enter integer (32 - 126):\n')) + +user_float = float(input('Enter float:\n')) + +user_char = '' +while len(user_char) != 1: + user_char = str(input('Enter character:\n')) + +user_string = str(input('Enter string:\n')) +results = [user_int, user_float, user_char, user_string] + +print(*results) +results.reverse() +print(*results) + +print('{0} converted to a character is {1}'.format(user_int, chr(user_int))) diff --git a/test.py b/test.py new file mode 100644 index 0000000..f94b601 --- /dev/null +++ b/test.py @@ -0,0 +1,6 @@ +a = 3 +x = 4 +y = a * x +y = y + 7 + +print (x, y) \ No newline at end of file