All Projects → gophercises → Quiz

gophercises / Quiz

Ex 1 - Run timed quizzes via the command line

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Quiz

Str
str: yet another string library for C language.
Stars: ✭ 159 (-32.05%)
Mutual labels:  strings
Stringz
💯 Super fast unicode-aware string manipulation Javascript library
Stars: ✭ 181 (-22.65%)
Mutual labels:  strings
React Intl Tel Input
Rewrite International Telephone Input in React.js. (Looking for maintainers, and PRs & contributors are also welcomed!)
Stars: ✭ 212 (-9.4%)
Mutual labels:  flags
Visual Chatbot
☁️ 👀 💬 Visual Chatbot
Stars: ✭ 161 (-31.2%)
Mutual labels:  channels
Phoenix client
Elixir Phoenix Client for Channels
Stars: ✭ 180 (-23.08%)
Mutual labels:  channels
Go Flagz
Dynamic flag management for Go.
Stars: ✭ 191 (-18.38%)
Mutual labels:  flags
Flare Floss
FLARE Obfuscated String Solver - Automatically extract obfuscated strings from malware.
Stars: ✭ 2,020 (+763.25%)
Mutual labels:  strings
Djangochannelsrestframework
A Rest-framework for websockets using Django channels-v3
Stars: ✭ 224 (-4.27%)
Mutual labels:  channels
Threadbox
Recursive Worker Threads in NodeJS
Stars: ✭ 181 (-22.65%)
Mutual labels:  channels
Goutil
💪 Helper Utils For The Go: string, array/slice, map, format, cli, env, filesystem, test and more. Go 的一些工具函数,格式化,特殊处理,常用信息获取等等
Stars: ✭ 205 (-12.39%)
Mutual labels:  strings
Graphene Django Subscriptions
This package adds support to Subscription's requests and its integration with websockets using Channels package.
Stars: ✭ 173 (-26.07%)
Mutual labels:  channels
L10n Swift
Localization of the application with ability to change language "on the fly" and support for plural form in any language.
Stars: ✭ 177 (-24.36%)
Mutual labels:  strings
Ifmt
Inline expression interpolation for Rust.
Stars: ✭ 197 (-15.81%)
Mutual labels:  strings
Blog
Our open source benchmarks and code samples
Stars: ✭ 162 (-30.77%)
Mutual labels:  strings
Flaeg
golang CLI with magic
Stars: ✭ 222 (-5.13%)
Mutual labels:  flags
Envy
Envy automatically exposes environment variables for all of your Go flags
Stars: ✭ 150 (-35.9%)
Mutual labels:  flags
String Similarity
Finds degree of similarity between two strings, based on Dice's Coefficient, which is mostly better than Levenshtein distance.
Stars: ✭ 2,254 (+863.25%)
Mutual labels:  strings
Config
📝 Go config manage(load,get,set). support JSON, YAML, TOML, INI, HCL, ENV and Flags. Multi file load, data override merge, parse ENV var. Go应用配置加载管理,支持多种格式,多文件加载,远程文件加载,支持数据合并,解析环境变量名
Stars: ✭ 225 (-3.85%)
Mutual labels:  flags
Stringy
A PHP string manipulation library with multibyte support
Stars: ✭ 2,461 (+951.71%)
Mutual labels:  strings
Util
A collection of useful utility functions
Stars: ✭ 201 (-14.1%)
Mutual labels:  strings

Exercise #1: Quiz Game

exercise status: released

Exercise details

This exercise is broken into two parts to help simplify the process of explaining it as well as to make it easier to solve. The second part is harder than the first, so if you get stuck feel free to move on to another problem then come back to part 2 later.

Note: I didn't break this into multiple exercises like I do for some exercises because both of these combined should only take ~30m to cover in screencasts.

Part 1

Create a program that will read in a quiz provided via a CSV file (more details below) and will then give the quiz to a user keeping track of how many questions they get right and how many they get incorrect. Regardless of whether the answer is correct or wrong the next question should be asked immediately afterwards.

The CSV file should default to problems.csv (example shown below), but the user should be able to customize the filename via a flag.

The CSV file will be in a format like below, where the first column is a question and the second column in the same row is the answer to that question.

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

You can assume that quizzes will be relatively short (< 100 questions) and will have single word/number answers.

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 are considered incorrect.

NOTE: CSV files may have questions with commas in them. Eg: "what 2+2, sir?",4 is a valid row in a CSV. I suggest you look into the CSV package in Go and don't try to write your own CSV parser.

Part 2

Adapt your program from part 1 to add a timer. The default time limit should be 30 seconds, but should also be customizable via a flag.

Your quiz should stop as soon as the time limit has exceeded. That is, you shouldn't wait for the user to answer one final questions but should ideally stop the quiz entirely even if you are currently waiting on an answer from the end user.

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 still 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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].