Can figure out how get my program to keep track of a total score, here is my code so far in python 3.6.6
import math
import random
import turtle
def target():
"""Turtle drawing the target"""
t = turtle.Turtle()
wn = turtle.Screen()
wn.bgcolor("black")
t.hideturtle()
t.speed(0)
#most outside circle worth 10 points
t.setposition(0,-275)
t.color("grey")
t.begin_fill()
t.circle(275)
t.end_fill()
#2nd most outter circle worth 20 points
t.penup()
t.setposition(0,-200)
t.pendown()
t.color("red")
t.begin_fill()
t.circle(200)
t.end_fill()
#3rd most outter circle worth 30 points
t.penup()
t.setposition(0,-125)
t.pendown()
t.color("orange")
t.begin_fill()
t.circle(125)
t.end_fill()
#center circle worth 50 points
t.penup()
t.setposition(0,-50)
t.pendown()
t.color("blue")
t.begin_fill()
t.circle(50)
t.end_fill()
t.showturtle()
def drawCross(pen, color, size, x, y):
pen.pensize(3)
pen.color(color)
pen.penup()
pen.goto(x-size,y-size)
pen.pendown()
pen.goto(x+size,y+size)
pen.penup()
pen.goto(x-size,y+size)
pen.pendown()
pen.goto(x+size,y-size)
def calculateScore(arrowx,arrowy):
score = 0
totalScore = 0
totalScore = totalScore + score
distance = 0
distance = math.sqrt((arrowx ** 2) + (arrowy ** 2))
if (distance <= 50):
score = 50
print(f"\nGreat shot! You just scored {score} points!")
elif (distance > 50 and distance <= 125):
score = 30
print(f"\nGreat shot! You just scored {score} points!")
elif (distance > 125 and distance <= 200):
score = 20
print(f"\nGreat shot! You just scored {score} points!")
elif (distance > 200 and distance <= 275):
score = 10
print(f"\nGreat shot! You just scored {score} points!")
elif (distance > 275):
score = 0
print(f"\nToo bad, you missed the target and you scored {score}
points :(")
return totalScore
def main():
"""Starts the archery game. Lets user choose how many arrows they
want to fire at the target"""
user = str(input("Please enter name: "))
print(f"\nHello, {user}! Welcome to the wonderful game of
Archery!")
choice = ""
while(choice != "q"):
#Menu options
print("\nPlease choose an option:")
print(" 1. Fire one arrow")
print(" 2. Fire many arrows")
print(" 3. Reset the target")
print(" q. Quit")
choice = input(f"\n")
#for firing one arrow
if(choice == "1"):
target()
myPen = turtle.Turtle()
myPen.speed(0)
myPen.shape("arrow")
#Shooting the arrow
arrowx= random.randint(-300,300)
arrowy= random.randint(-300,300)
drawCross(myPen,"cyan",10,arrowx,arrowy)
calculateScore(arrowx,arrowy)
myPen.hideturtle()
myPen.getscreen().update()
elif(choice == "2"):
manyArrows = int(input("\nHow many arrows would you like to fire?
"))
target()
myPen = turtle.Turtle()
myPen.speed(0)
myPen.shape("arrow")
for x in range(manyArrows):
arrowx= random.randint(-300,300)
arrowy= random.randint(-300,300)
drawCross(myPen, "cyan", 10, arrowx, arrowy)
calculateScore(arrowx,arrowy)
import math
import random
import turtle
def target():
"""Turtle drawing the target"""
t = turtle.Turtle()
wn = turtle.Screen()
wn.bgcolor("black")
t.hideturtle()
t.speed(0)
# most outside circle worth 10 points
t.setposition(0, -275)
t.color("grey")
t.begin_fill()
t.circle(275)
t.end_fill()
# 2nd most outter circle worth 20 points
t.penup()
t.setposition(0, -200)
t.pendown()
t.color("red")
t.begin_fill()
t.circle(200)
t.end_fill()
# 3rd most outter circle worth 30 points
t.penup()
t.setposition(0, -125)
t.pendown()
t.color("orange")
t.begin_fill()
t.circle(125)
t.end_fill()
# center circle worth 50 points
t.penup()
t.setposition(0, -50)
t.pendown()
t.color("blue")
t.begin_fill()
t.circle(50)
t.end_fill()
t.showturtle()
def drawCross(pen, color, size, x, y):
pen.pensize(3)
pen.color(color)
pen.penup()
pen.goto(x - size, y - size)
pen.pendown()
pen.goto(x + size, y + size)
pen.penup()
pen.goto(x - size, y + size)
pen.pendown()
pen.goto(x + size, y - size)
def calculateScore(arrowx, arrowy):
score = 0
distance = 0
distance = math.sqrt((arrowx ** 2) + (arrowy ** 2))
if (distance <= 50):
score = 50
print(f"\nGreat shot! You just scored {score} points!")
elif (distance > 50 and distance <= 125):
score = 30
print(f"\nGreat shot! You just scored {score} points!")
elif (distance > 125 and distance <= 200):
score = 20
print(f"\nGreat shot! You just scored {score} points!")
elif (distance > 200 and distance <= 275):
score = 10
print(f"\nGreat shot! You just scored {score} points!")
elif (distance > 275):
score = 0
print(f"\nToo bad, you missed the target and you scored {score} points :(")
return score
def main():
"""Starts the archery game. Lets user choose how many arrows they want to fire at the target"""
user = str(input("Please enter name: "))
print(f"\nHello, {user}! Welcome to the wonderful game of Archery!")
choice = ""
while (choice != "q"):
# Menu options
print("\nPlease choose an option:")
print(" 1. Fire one arrow")
print(" 2. Fire many arrows")
print(" 3. Reset the target")
print(" q. Quit")
choice = input(f"\n")
# for firing one arrow
if (choice == "1"):
target()
myPen = turtle.Turtle()
myPen.speed(0)
myPen.shape("arrow")
# Shooting the arrow
arrowx = random.randint(-300, 300)
arrowy = random.randint(-300, 300)
drawCross(myPen, "cyan", 10, arrowx, arrowy)
calculateScore(arrowx, arrowy)
myPen.hideturtle()
myPen.getscreen().update()
elif (choice == "2"):
manyArrows = int(input("\nHow many arrows would you like to fire? "))
target()
myPen = turtle.Turtle()
myPen.speed(0)
myPen.shape("arrow")
total=0
for x in range(manyArrows):
arrowx = random.randint(-300, 300)
arrowy = random.randint(-300, 300)
drawCross(myPen, "cyan", 10, arrowx, arrowy)
total+=calculateScore(arrowx, arrowy)
print('Your total score =',total)
if __name__ == '__main__':
main()

Can figure out how get my program to keep track of a total score, here is...
I am having trouble with my Python code in this dictionary and
pickle program. Here is my code but it is not running as i am
receiving synthax error on the second line.
class Student:
def__init__(self,id,name,midterm,final):
self.id=id
self.name=name
self.midterm=midterm
self.final=final
def calculate_grade(self):
self.avg=(self.midterm+self.final)/2
if self.avg>=60 and self.avg<=80:
self.g='A'
elif self.avg>80 and self.avg<=100:
self.g='A+'
elif self.avg<60 and self.avg>=40:
self.g='B'
else:
self.g='C'
def getdata(self):
return self.id,self.name.self.midterm,self.final,self.g
CIT101 = {}
CIT101["123"] = Student("123", "smith, john", 78, 86)
CIT101["124"] = Student("124", "tom, alter", 50,...