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

@@ -15,14 +15,6 @@ Ported by Dave LeCompte
import time
def print_with_tab(spaces_count: int, msg: str) -> None:
if spaces_count > 0:
spaces = " " * spaces_count
else:
spaces = ""
print(spaces + msg)
def get_yes_or_no():
while True:
response = input().upper()
@@ -62,11 +54,8 @@ def play_game():
def main() -> None:
print_with_tab(33, "NICOMA")
print_with_tab(15, "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
print()
print()
print()
print(" " * 33 + "NICOMA")
print(" " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n\n\n")
print("BOOMERANG PUZZLE FROM ARITHMETICA OF NICOMACHUS -- A.D. 90!")
print()