Simplify Python Code

print_with_tab / print_with_whitespace is trivial with Python
string formatting and was mostly used in only 2 lines.
This commit is contained in:
Martin Thoma
2022-04-02 07:32:09 +02:00
parent 354c1f9ab3
commit c500424956
47 changed files with 208 additions and 387 deletions

View File

@@ -24,7 +24,6 @@ cards = {
def play_game() -> None:
"""Play the game"""
cash = 100
while cash > 0:
print(f"You now have {cash} dollars\n")
@@ -64,16 +63,6 @@ def play_game() -> None:
def main() -> None:
"""Main"""
keep_playing = True
while keep_playing:
play_game()
keep_playing = input("Try again? (yes or no) ").lower().startswith("y")
print("Ok hope you had fun")
if __name__ == "__main__":
print(
"""
Acey-Ducey is played in the following manner
@@ -84,4 +73,13 @@ a value between the first two.
If you do not want to bet, input a 0
"""
)
keep_playing = True
while keep_playing:
play_game()
keep_playing = input("Try again? (yes or no) ").lower().startswith("y")
print("Ok hope you had fun")
if __name__ == "__main__":
main()