You are Here: Home >< GCSEs

# A453 Arithmetic Quiz Task 2

Announcements Posted on
Four hours left to win £100 of Amazon vouchers!! Don't miss out! Take our short survey to enter 24-10-2016
1. import random#all the questions will be completely random
score = 0#program will calculate their scores(starts with 0)
ops = ['+','-','*']#list of the possible operations the random generator can choose to use for the 10 questions

print("************************* ******************************** ******************************** *************WELCOME TO THE ARITHMETIC QUIZ!!************************** ")
print(" ")#for presentation purposes
print(" ")
name=input(" Enter your name:")#python will store the user's name into a variable
print(" Welcome to the Arithmetic Quiz",name,"! Good luck!")#

this part is wrong:

'5B'==class1
'5G'==class2
'5R'==class3

if usersclass==class1:
open("class5B.txt","a+")
if usersclass==class2:
open("class5G.txt","a+")
if usersclass==class3:
open("class5R.txt","a+")

the rest works, apart from the small section above

for i in range(10)this allows the questions to be asked for a total of 10 times
FirstNumber = random.randint(1,15)#all the random numbers generated will range from the numbers 1 to 15
SecondNumber = random.randint(1,15)
operation = random.choice(ops)#random operations will be generated for each question
print(" ")
print(" What does",FirstNumber,operation, SecondNumber,"equal to?")
user = int(input(" Enter your answer:"))#user can give their response to the question

if operation == "+":
answer = FirstNumber + SecondNumber#if the operation is addition, the program will work out the answer taking in this information
elif operation == "-":
elif operation == "*":

print(" That is the correct answer! Keep it up.")#gives the user a message when correct
score = score + 1#with each correct answer, a score is added
else:
print(" That is incorrect. The correct answer is",answer)#gives the user a message when incorrect

print(" ")
print(" Your total score is:",score,"/10")#displays their total score

myfile=open('arithmetic_quiz_res ults.txt','w')
class1=input("Enter class: ")
myfile.write("Class:" +class1+"\n")
for x in range (1):
name=input("Student's name: \n")
result=input("Score: ")
myfile.write(name +'-'+result)
myfile.close()

That's my coding and If anyone else takes computer science can you please help me? I'm way past my deadline and would like some advice or help with how to do the coding. Thank you
2. (Original post by aliyahh16)
import random#all the questions will be completely random
score = 0#program will calculate their scores(starts with 0)
ops = ['+','-','*']#list of the possible operations the random generator can choose to use for the 10 questions

print("************************* ******************************** ******************************** *************WELCOME TO THE ARITHMETIC QUIZ!!************************** "
print(" "#for presentation purposes
print(" "
name=input(" Enter your name:"#python will store the user's name into a variable
print(" Welcome to the Arithmetic Quiz",name,"! Good luck!"#

this part is wrong:

'5B'==class1
'5G'==class2
'5R'==class3

if usersclass==class1:
open("class5B.txt","a+"
if usersclass==class2:
open("class5G.txt","a+"
if usersclass==class3:
open("class5R.txt","a+"

the rest works, apart from the small section above

for i in range(10)this allows the questions to be asked for a total of 10 times
FirstNumber = random.randint(1,15)#all the random numbers generated will range from the numbers 1 to 15
SecondNumber = random.randint(1,15)
operation = random.choice(ops)#random operations will be generated for each question
print(" "
print(" What does",FirstNumber,operation, SecondNumber,"equal to?"
user = int(input(" Enter your answer:")#user can give their response to the question

if operation == "+":
answer = FirstNumber + SecondNumber#if the operation is addition, the program will work out the answer taking in this information
elif operation == "-":
elif operation == "*":

print(" That is the correct answer! Keep it up."#gives the user a message when correct
score = score + 1#with each correct answer, a score is added
else:
print(" That is incorrect. The correct answer is",answer)#gives the user a message when incorrect

print(" "
print(" Your total score is:",score,"/10"#displays their total score

myfile=open('arithmetic_quiz_res ults.txt','w'
class1=input("Enter class: "
myfile.write("Class:" +class1+"\n"
for x in range (1):
name=input("Student's name: \n"
result=input("Score: "
myfile.write(name +'-'+result)
myfile.close()

That's my coding and If anyone else takes computer science can you please help me? I'm way past my deadline and would like some advice or help with how to do the coding. Thank you
Is this the quiz one? Where you have to make a quiz? My code is much shorter I think
3. (Original post by zXcodeXz)
Is this the quiz one? Where you have to make a quiz? My code is much shorter I think
yepp, that's the one
maybe mines extra long bc I print out blank spaces for presentational purposes and stuff

What did you for task 2?
i'm trying different things but I don't know how to create 3 different files for the 3 classes so that when the student enters their class, their results are inputted into that particular file
4. (Original post by aliyahh16)
yepp, that's the one
maybe mines extra long bc I print out blank spaces for presentational purposes and stuff

What did you for task 2?
i'm trying different things but I don't know how to create 3 different files for the 3 classes so that when the student enters their class, their results are inputted into that particular file
I'll check online what I wrote and I'll get back to you, by the way have you got the code for task 3?

## Register

Thanks for posting! You just need to create an account in order to submit the post
1. this can't be left blank
2. this can't be left blank
3. this can't be left blank

6 characters or longer with both numbers and letters is safer

4. this can't be left empty
1. Oops, you need to agree to our Ts&Cs to register

Updated: April 10, 2016
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Today on TSR

### Who is getting a uni offer this half term?

Find out which unis are hot off the mark here

Poll
Useful resources

## Study tools

### Essay expert

Learn to write like a pro with our ultimate essay guide.

See where you can apply with our uni match tool

### Make study resources

Create all the resources you need to get the grades.

### Create your own Study Plan

Organise all your homework and exams so you never miss another deadline.

### Resources by subject

From flashcards to mind maps; there's everything you need for all of your GCSE subjects.

### Find past papers

100s of GCSE past papers for all your subjects at your fingertips.