Update mad_lib.py

This commit is contained in:
Joe S 2021-01-08 21:04:11 -05:00
parent affefca9a6
commit 0b457c6c88
1 changed files with 5 additions and 1 deletions

View File

@ -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())