Random arithmetic quiz

0

Given a and b as two random numbers from 0 to 10 and op as a random symbol of arithmetic operations, you should display 10 questions in the format:

a op b = 

to the user, after each question if the user is correct you should output :), if he is wrong :(.

At the end you should print the correct answers and the total number of questions as a fraction (ex.): 7 / 10

  • The programme must be random, that is, each time that it is run, it must chose different numbers and operators.

  • eval is strictly forbidden.

  • Addition (+), Subtraction (-), and Multiplication(*) are necessary, division can be cumbersome due to x / 0 and floating point weirdness, implementing it grants you a *0.8 bonus. User should have a precision of one digit after the comma, both rounding up and down are considered correct regardless of the following digit. (ex: 7 / 6 -> 1.1 or 1.2) both are correct

Code Golf, may the shortest win

Caridorc

Posted 2015-03-24T13:39:27.670

Reputation: 2 254

Question was closed 2015-03-24T14:28:50.310

Sorry, I should look harder for duplicates... – Caridorc – 2015-03-24T18:00:44.213

1You used sufficiently different language that I failed to find the duplicate even though I distinctly remembered that there was one, so don't feel too bad about not finding it. – Peter Taylor – 2015-03-24T20:26:16.673

No answers