# Arup Guha
# 6/3/2024
# Review of Loops, Loop Control in Python

import random

'''

# for v1 - it will count 0, 1, 2, ..., end-1
tot = 0
for i in range(10):
    tot = tot + i + 1
    print("after adding",i+1,"we get",tot)

# for v2 - we give it the start (inclusive) and end(exclusive)
tot = 0
for i in range(10,21):
    tot = tot + i
    print("after adding",i,"we get",tot)

# for v3 - we go from start to end (exclusive), adding skip each time.
#          for i in range(start, end, skip):
for i in range(0,55,5):
    print(i, end= " ")
for i in range(45, -5, -5):
    print(i, end = " ")
print()



# while

# Generates a random number from start to end inclusive.
secret = random.randint(1, 100)
guess = -1
numguesses = 0

# Keeps on going until you guess the right number.
while guess != secret:

    # Get the next guess.
    guess = int(input("Enter your next guess.\n"))
    numguesses += 1

    # Output accordingly.
    if guess > secret:
        print("Sorry you guessed too high. Guess lower.")
    elif guess < secret:
        print("Sorry you guessed too low. Guess higher.")
    else:
        print("Great, you got the number in",numguesses,"guesses.")


# break
n = int(input("Enter a positive integer greater than 1.\n"))
isprime = True

# i is the number I am trying to divide by.
for i in range(2,n):

    if n%i == 0:
        isprime = False
        break

    print("End loop",i)

if isprime:
    print(n,"is a prime number.")
else:
    print(n,"is a composite number.")
'''

# continue
tot = 0
numscores = 0
print("Please enter 10 test scores, 1 per line.")

for i in range(10):

    # Read in this score.
    score = int(input())

    # Skip over invalid scores.
    if score < 0 or score > 100:
        print("Invalid score, not counted.")
        continue

    # Add to total sum of scores and number of scores.
    tot += score
    numscores += 1

if numscores > 0:
    print("Average score was", tot/numscores)
else:
    print("No valid scores entered.")

