The golden standard for style in python is PEP 8. It explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.
Use the
if __name__ == "__main__":
if __name__ == "__main__":
module. It makes your code clearer and reusable.blanks
does not have to be a list of dicts. It is clearer if it only holds the type'%s %s' % ('one', 'two')
is the old string format while'{} {}'.format('one', 'two')
is the new one. I recommend sticking with the new one. Check here to learn more about Pythons awesome string formating options.if len(ans) == 0:
is a unorthodox way to change if a string is empty. A more pythonic approach isif not ans
.Do not use
quit()
a better approach is to make theans
into a while loopfor blank in blanks: ans = "" while not ans: ans = input(blank.capitalize() + "> ") if not ans: print("Please don't leave anything blank. It kills the experience.") blank['ans'] = ans
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the story. The key here is.lower()
.if feedback.lower() == "y": print("Thanks!")
Your commenting is good, however it could be improved by using doc strings.
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors. Another code to ask the user to play again and so forth. A basic structure is something like the followingimport
CONSTANTS
def some_function():
def another_function():
def main() while True: some_function() play_again = input('do you want to play again? [y/n]: ') if play_again.lower() not in ['y', 'yes', 'ok']: break
if name == 'main': main()
In PEP 8, it is recommended that the maximum linewidth is 79 characters. This is a good rule of thumb. You can use triple quotation marks to format long strings. Here are Here are some other methods to format long strings.
The golden standard for style in python is PEP 8. It explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.
Use the
if __name__ == "__main__":
module. It makes your code clearer and reusable.blanks
does not have to be a list of dicts. It is clearer if it only holds the type'%s %s' % ('one', 'two')
is the old string format while'{} {}'.format('one', 'two')
is the new one. I recommend sticking with the new one. Check here to learn more about Pythons awesome string formating options.if len(ans) == 0:
is a unorthodox way to change if a string is empty. A more pythonic approach isif not ans
.Do not use
quit()
a better approach is to make theans
into a while loopfor blank in blanks: ans = "" while not ans: ans = input(blank.capitalize() + "> ") if not ans: print("Please don't leave anything blank. It kills the experience.") blank['ans'] = ans
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the story. The key here is.lower()
.if feedback.lower() == "y": print("Thanks!")
Your commenting is good, however it could be improved by using doc strings.
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors. Another code to ask the user to play again and so forth. A basic structure is something like the followingimport
CONSTANTS
def some_function():
def another_function():
def main() while True: some_function() play_again = input('do you want to play again? [y/n]: ') if play_again.lower() not in ['y', 'yes', 'ok']: break
if name == 'main': main()
In PEP 8, it is recommended that the maximum linewidth is 79 characters. This is a good rule of thumb. You can use triple quotation marks to format long strings. Here are some other methods to format long strings.
The golden standard for style in python is PEP 8. It explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.
Use the
if __name__ == "__main__":
module. It makes your code clearer and reusable.blanks
does not have to be a list of dicts. It is clearer if it only holds the type'%s %s' % ('one', 'two')
is the old string format while'{} {}'.format('one', 'two')
is the new one. I recommend sticking with the new one. Check here to learn more about Pythons awesome string formating options.if len(ans) == 0:
is a unorthodox way to change if a string is empty. A more pythonic approach isif not ans
.Do not use
quit()
a better approach is to make theans
into a while loopfor blank in blanks: ans = "" while not ans: ans = input(blank.capitalize() + "> ") if not ans: print("Please don't leave anything blank. It kills the experience.") blank['ans'] = ans
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the story. The key here is.lower()
.if feedback.lower() == "y": print("Thanks!")
Your commenting is good, however it could be improved by using doc strings.
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors. Another code to ask the user to play again and so forth. A basic structure is something like the followingimport
CONSTANTS
def some_function():
def another_function():
def main() while True: some_function() play_again = input('do you want to play again? [y/n]: ') if play_again.lower() not in ['y', 'yes', 'ok']: break
if name == 'main': main()
In PEP 8, it is recommended that the maximum linewidth is 79 characters. This is a good rule of thumb. You can use triple quotation marks to format long strings. Here are some other methods to format long strings.
The golden standard for style in python is PEP 8. It explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.
Use the
if __name__ == "__main__":
module. It makes your code clearer and reusable.blanks
does not have to be a list of dicts. It is clearer if it only holds the type'%s %s' % ('one', 'two')
is the old string format while'{} {}'.format('one', 'two')
is the new one. I recommend sticking with the new one. Check here to learn more about Pythons awesome string formating options.if len(ans) == 0:
is a unorthodox way to change if a string is empty. A more pythonic approach isif not ans
.Do not use
quit()
a better approach is to make theans
into a while loopfor blank in blanks: ans = "" while not ans: ans = input(blank.capitalize() + "> ") if not ans: print("Please don't leave anything blank. It kills the experience.") blank['ans'] = ans
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the story. The key here is.lower()
.if feedback.lower() == "y": print("Thanks!")
Your commenting is good, however it could be improved by using doc strings.
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors. Another code to ask the user to play again and so forth. A basic structure is something like the followingimport
CONSTANTS
def some_function():
def another_function():
def main() while True: some_function() play_again = input('do you want to play again? [y/n]: ') if play_again.lower() not in ['y', 'yes', 'ok']: break
if name == 'main': main()
In PEP 8, it is recommended that the maximum linewidth is 79 characters. This is a good rule of thumb. You can use triple parenthesisquotation marks to format long strings. Here are some other methods to format long strings.
The golden standard for style in python is PEP 8. It explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.
Use the
if __name__ == "__main__":
module. It makes your code clearer and reusable.blanks
does not have to be a list of dicts. It is clearer if it only holds the type'%s %s' % ('one', 'two')
is the old string format while'{} {}'.format('one', 'two')
is the new one. I recommend sticking with the new one. Check here to learn more about Pythons awesome string formating options.if len(ans) == 0:
is a unorthodox way to change if a string is empty. A more pythonic approach isif not ans
.Do not use
quit()
a better approach is to make theans
into a while loopfor blank in blanks: ans = "" while not ans: ans = input(blank.capitalize() + "> ") if not ans: print("Please don't leave anything blank. It kills the experience.") blank['ans'] = ans
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the story. The key here is.lower()
.if feedback.lower() == "y": print("Thanks!")
Your commenting is good, however it could be improved by using doc strings.
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors. Another code to ask the user to play again and so forth. A basic structure is something like the followingimport
CONSTANTS
def some_function():
def another_function():
def main() while True: some_function() play_again = input('do you want to play again? [y/n]: ') if play_again.lower() not in ['y', 'yes', 'ok']: break
if name == 'main': main()
In PEP 8, it is recommended that the maximum linewidth is 79 characters. This is a good rule of thumb. You can use triple parenthesis to format long strings.
The golden standard for style in python is PEP 8. It explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.
Use the
if __name__ == "__main__":
module. It makes your code clearer and reusable.blanks
does not have to be a list of dicts. It is clearer if it only holds the type'%s %s' % ('one', 'two')
is the old string format while'{} {}'.format('one', 'two')
is the new one. I recommend sticking with the new one. Check here to learn more about Pythons awesome string formating options.if len(ans) == 0:
is a unorthodox way to change if a string is empty. A more pythonic approach isif not ans
.Do not use
quit()
a better approach is to make theans
into a while loopfor blank in blanks: ans = "" while not ans: ans = input(blank.capitalize() + "> ") if not ans: print("Please don't leave anything blank. It kills the experience.") blank['ans'] = ans
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the story. The key here is.lower()
.if feedback.lower() == "y": print("Thanks!")
Your commenting is good, however it could be improved by using doc strings.
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors. Another code to ask the user to play again and so forth. A basic structure is something like the followingimport
CONSTANTS
def some_function():
def another_function():
def main() while True: some_function() play_again = input('do you want to play again? [y/n]: ') if play_again.lower() not in ['y', 'yes', 'ok']: break
if name == 'main': main()
In PEP 8, it is recommended that the maximum linewidth is 79 characters. This is a good rule of thumb. You can use triple quotation marks to format long strings. Here are some other methods to format long strings.
The golden standard for style in python is PEP 8. It explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.
Use the
if __name__ == "__main__":
module. It makes your code clearer and reusable.blanks
does not have to be a list of dicts. It is clearer if it only holds the typeThe old string format for Python was
'%s %s' % ('one', 'two')
whileis the old string format while'{} {}'.format('one', 'two')
is the new one. I recommend sticking with with the new one. Check here to learn more about Pythons awesomestring formating options.if len(ans) == 0:
is a unorthodox way to change if a string is empty. A more pythonic approach isif not ans
.Do not use
quit()
a better approach is to make theans
into a while loopfor blank in blanks: ans = "" while not ans: ans = input(blank.capitalize() + "> ") if not ans: print("Please don't leave anything blank. It kills the experience.") blank['ans'] = ans
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the story. The key here is.lower()
.if feedback.lower() == "y": print("Thanks!")
Your commenting is good, however it could be improved by using doc strings .
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors. Another code to ask the user to play again and so forth. A basic structure is something like the followingimport
CONSTANTS
def some_function():
def another_function():
def main() while True: some_function() play_again = input('do you want to play again? [y/n]: ') if play_again.lower() not in ['y', 'yes', 'ok']: break
if name == 'main': main()
In PEP 8, it is recommended that the maximum linewidth is 79 characters . This is a good rule of thumb. You can use triple parenthesis to format long strings.
\${}{}\$
for blank in blanks:
ans = ""
while not ans:
ans = input(blank.capitalize() + "> ")
if not ans:
print("Please don't leave anything blank. It kills the experience.")
blank['ans'] = ans
\${}{}\$
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the store. The key here is.lower()
.Your commenting is good, however it could be improved by using doc strings
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors.In PEP 8, it is recommended that the maximum linewidth is 79 characters . This is a good rule of thumb. You can use triple parenthesis to format long strings.
The golden standard for style in python is PEP 8. It explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.
Use the
if __name__ == "__main__":
module. It makes your code clearer and reusable.blanks
does not have to be a list of dicts. It is clearer if it only holds the typeThe old string format for Python was
'%s %s' % ('one', 'two')
while the'{} {}'.format('one', 'two')
is the new one. I recommend sticking with the new one. Check here to learn more about Pythons awesomestring formating options.if len(ans) == 0:
is a unorthodox way to change if a string is empty. A more pythonic approach isif not ans
.Do not use
quit()
a better approach is to make theans
into a while loop
\${}{}\$
for blank in blanks:
ans = ""
while not ans:
ans = input(blank.capitalize() + "> ")
if not ans:
print("Please don't leave anything blank. It kills the experience.")
blank['ans'] = ans
\${}{}\$
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the store. The key here is.lower()
.Your commenting is good, however it could be improved by using doc strings
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors.In PEP 8, it is recommended that the maximum linewidth is 79 characters . This is a good rule of thumb. You can use triple parenthesis to format long strings.
The golden standard for style in python is PEP 8. It explains in excruciating detail how to structure your code. I whole heartily recommend skimming through it and follow it.
Use the
if __name__ == "__main__":
module. It makes your code clearer and reusable.blanks
does not have to be a list of dicts. It is clearer if it only holds the type'%s %s' % ('one', 'two')
is the old string format while'{} {}'.format('one', 'two')
is the new one. I recommend sticking with the new one. Check here to learn more about Pythons awesomestring formating options.if len(ans) == 0:
is a unorthodox way to change if a string is empty. A more pythonic approach isif not ans
.Do not use
quit()
a better approach is to make theans
into a while loopfor blank in blanks: ans = "" while not ans: ans = input(blank.capitalize() + "> ") if not ans: print("Please don't leave anything blank. It kills the experience.") blank['ans'] = ans
A bigger concern is that you update
blank['ans'] = ans
, but then immediately move the values into a list.fs = [] # Get the answers from the blanks list for dictionary in blanks: fs.append(dictionary['ans'])
Why not have the
answers
as a list from the start?You
capitalize
the words on input. However when asking if the user liked the story you do not lower the words. When i writeY
it tells me I did not like the story. The key here is.lower()
.if feedback.lower() == "y": print("Thanks!")
Your commenting is good, however it could be improved by using doc strings .
A more severe concern with your code is that it is not modular. You have everything lumped into a single file. Really you should NEVER have that. Create a function named
get_user_input
which handles all the errors. Another code to ask the user to play again and so forth. A basic structure is something like the followingimport
CONSTANTS
def some_function():
def another_function():
def main() while True: some_function() play_again = input('do you want to play again? [y/n]: ') if play_again.lower() not in ['y', 'yes', 'ok']: break
if name == 'main': main()
In PEP 8, it is recommended that the maximum linewidth is 79 characters . This is a good rule of thumb. You can use triple parenthesis to format long strings.