Hi, I have created a quiz whixh displays an artist and the first letter of their song and the user has to guess the song. However, I need help looping the quiz so it displays another artists if the user has anwered correctly after their first or second guess. Thank You
score=0
import random
def random_line(songs):
lines =open("songs.txt").read().splitlines()
return random.choice(lines)
print(random_line("songs.txt"))
guess1=input("please enter your first guess:\n")
found = False
with open('answers.txt') as file:
for line in file:
line = line.strip()
if guess1== line:
print("Your answer is correct")
found = True
score = score + 3
print("You score is ",score,"points")
break
else:
print(" Incorrect")
guess2=input("please try again:\n")
found = False
with open('answers.txt') as file:
for line in file:
line = line.strip()
if guess2== line:
print("Your answer is correct")
found = True
score = score +1
print("You score is ",score,"points")
break
else:
print("You have answered incorrectly twice - GAME OVER!")
print("Your final score is",score,"points")