← Back to Week 2 Hub
Workbook 2a — Exercise 3

HighScore Wins

Parse a game score string and determine the winner  |  Workbook p.20-21

What You're Building

The user enters a game score in the format TeamA:TeamB|ScoreA:ScoreB. Your program needs to pull apart that string to find the two team names and their scores, then announce which team won.

Example Run
Run 1 — First team wins
Enter the game score (TeamA:TeamB|ScoreA:ScoreB): Home:Visitor|21:9

Winner: Home
Run 2 — Second team wins
Enter the game score (TeamA:TeamB|ScoreA:ScoreB): Slytherin:Gryffindor|23:59

Winner: Gryffindor
Concepts You'll Use
Flow Diagram
Get input
Split on |
Split teams on :
Split scores on :
Parse scores
Compare
Display winner

Workbook 2a, p.20-21 — Exercise 3: HighScore Wins

← Full Name Parser Theater Reservations →