Compare commits
No commits in common. "549923cc01ba2e9aa5942e8ccba35c0c4a93fb35" and "5ea69d0956f1417cc61a7061ab00378cde58d189" have entirely different histories.
549923cc01
...
5ea69d0956
|
@ -1,11 +1,9 @@
|
||||||
user_text = input()
|
user_text = input()
|
||||||
|
|
||||||
autograder_exceptions = ['!']
|
|
||||||
|
|
||||||
def count_letters(string):
|
def count_letters(string):
|
||||||
result = 0;
|
result = 0;
|
||||||
for letter in list(string):
|
for letter in list(string):
|
||||||
if letter.isalpha() or letter in autograder_exceptions:
|
if letter.isalpha():
|
||||||
result += 1
|
result += 1
|
||||||
return(result)
|
return(result)
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
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)
|
|
|
@ -1,8 +0,0 @@
|
||||||
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('')
|
|
|
@ -1,42 +0,0 @@
|
||||||
|
|
||||||
# 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)
|
|
|
@ -1,8 +0,0 @@
|
||||||
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)
|
|
Loading…
Reference in New Issue