Skip to content

Commit

Permalink
Resolves cs50#174 for all test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Makaze committed Dec 1, 2023
1 parent 12bbc64 commit 0943536
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions einstein/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def test14():
output = check50.run("python3 einstein.py").stdin("14", prompt=False).stdout()

# Extract number from stdout
match = re.search(r"([.,]?(?:\d[.,]?)+)", output)
match = re.findall(r"([.,]?(?:\d[.,]?)+)", output)
if match is None:
raise check50.Failure("Looks like your program didn't output a number!")
number = match.group(0)
number = match[-1]

# Match correct number
if not re.match(r"^1,?260(?:,?0{3}){5}(?:\.0+)?$", number) and not re.match(
Expand All @@ -58,10 +58,10 @@ def test50():
output = check50.run("python3 einstein.py").stdin("50", prompt=False).stdout()

# Extract number from stdout
match = re.search(r"([.,]?(?:\d[.,]?)+)", output)
match = re.findall(r"([.,]?(?:\d[.,]?)+)", output)
if match is None:
raise check50.Failure("Looks like your program didn't output a number!")
number = match.group(0)
number = match[-1]

# Match correct number
if not re.match(r"^4,?500(?:,?0{3}){5}(?:\.0+)?$", number) and not re.match(
Expand Down

0 comments on commit 0943536

Please sign in to comment.