Preparing git repo for final project

This commit is contained in:
2023-07-09 11:19:26 +02:00
parent 6a38966eef
commit 63d06d6b35
67 changed files with 1587 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import re
answer_regex = re.compile(r"\s*(42|forty[ -]?two)\s*", re.IGNORECASE)
def ifelse_answer():
answer = input("What is the Answer to the Great Question of Life, the Universe, and Everything?\t\t")
answer = answer.strip()
answer = answer.replace('-', '')
answer = answer.replace(' ', '')
answer = answer.lower()
if answer in ('42', 'fortytwo'):
print("Yes")
else:
print("No")
def regex_answer():
print('Yes'
if answer_regex.match(
input("What is the Answer to the Great Question of Life, the Universe, and Everything?\t\t"))
else 'No')
def oneliner():
print({True: 'Yes', False: 'No'}[input("What is the Answer to the Great Question of Life, the Universe, and Everything?\t\t").lower().strip() in ('42', 'fortytwo', 'forty two', 'forty-two')])
if __name__ == "__main__":
regex_answer()