Я написал двойную программу для турнира по гольфу. Сначала записываются имя игрока в гольф и его счет. Второй вызывает эти данные и печатает их. Моя проблема в том, что когда я вызываю счет, я хочу преобразовать его в целое число, потому что мне нужно распечатать, был ли этот счет ниже номинального, номинального или более высокого, вместо того, чтобы фактически печатать счет. Итак, как мне преобразовать его в целое число после его вызова? И затем, где я могу поместить свой оператор if_else, чтобы преобразовать это целое число в значение ниже номинала, номинала, выше номинала?
вот что у меня есть до сих пор
#FIRST PROGRAM CODE
outfile = open('golf.txt', 'w')
#Enter input, leave blank to quit program
while True:
name = input("Player's first and last name(leave blank to quit):")
if name == "":
break
score = input("Player's score:")
#write to file golf.txt
outfile.write(name + "\n")
outfile.write(str(score) + "\n")
outfile.close()
#SECOND PROGRAM CODE
# main module/function
def main():
# opens the "golf.txt" file
# in read-only mode
infile = open('golf.txt', 'r')
# reads the player from the file
name = infile.readline()
while name != '':
# reads the score
score = infile.readline()
# strip newline from field
name = name.rstrip('\n')
score = score.rstrip('\n')
# prints the names and scores
print(name + " scored " + score)
# read the name field of next record
name = infile.readline()
# closes the file
infile.close()
# calls main function
main()