Skip to content
/ quiz Public
forked from gophercises/quiz

Ex 1 - Run timed quizzes via the command line

Notifications You must be signed in to change notification settings

laprej/quiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Exercise #1: Quiz Game

This exercise is broken into two parts.

Part 1

topic: csvs topic: flags topic: opening files topic: strings

Part 2

topic: goroutines topic: channels topic: timers

video status: unreleased code status: unreleased

Exercise details

Given a CSV like below, where the first column is the question and the second column is the answer:

5+5,10
7+3,10
1+1,2
8+3,11
1+2,3
8+6,14
3+1,4
1+4,5
5+1,6
2+3,5
3+3,6
2+4,6
5+2,7

Create a program that will accept the CSV filepath and a time limit (in seconds) as flags and will then run the the quiz reading each problem in order and stopping the quiz as soon as the time limit has been exceeded.

Users should be asked to press enter (or some other key) before the timer starts, and then the questions should be printed out to the screen one at a time until the user provides an answer. Regardless of whether the answer is correct or wrong the next question should be asked.

At the end of the quiz the program should output the total number of questions correct and how many questions there were in total. Questions given invalid answers or unanswered are considered incorrect.

Bonus

As a bonus exercises you can also...

  1. Add string trimming and cleanup to help ensure that correct answers with extra whitespace, capitalization, etc are not considered incorrect. Hint: Check out the strings package.
  2. Add an option (a new flag) to shuffle the quiz order each time it is run.

About

Ex 1 - Run timed quizzes via the command line

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%