From 0b457c6c882ce1336d6336e7fb98d84a59cb378f Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Fri, 8 Jan 2021 21:04:11 -0500 Subject: [PATCH] Update mad_lib.py --- 1/1.9 Mad Lib/mad_lib/mad_lib.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/1/1.9 Mad Lib/mad_lib/mad_lib.py b/1/1.9 Mad Lib/mad_lib/mad_lib.py index 8a2b393..321eec3 100644 --- a/1/1.9 Mad Lib/mad_lib/mad_lib.py +++ b/1/1.9 Mad Lib/mad_lib/mad_lib.py @@ -2,8 +2,12 @@ # 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 + + # Replace %text% with user input 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()) @@ -30,4 +34,4 @@ class mad_lib: # 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 +print(md.text)