我想更改函数内部的函数变量。这是代码:
import csv
import random
with open('songs.csv') as f:
#2 - start
reader = csv.reader(f)
chosen_row = random.choice(list(reader))
print(chosen_row[0][0] + ' by ' + chosen_row[1])
def song():
answer = input("what is your answer? (all lowercase) :")
if chosen_row == ['Perfect', ' Ed sheeran']:
answer1 = 'perfect'
if answer == answer1:
print("3 points!")
points = points + 3
elif answer != answer1:
print("Wrong, 1 more attempt")
attempt = attempt + 1
attempt9 = input("what is your answer? (all lowercase) :")
if attempt9 == answer1:
print("1 point")
points = points + 1
attempt = attempt - 1
elif attempt9 != answer1:
attempt = attempt + 1
song()
#I want to change chosen_row and answer1