Ecco il mio codice. Devo aggiungere un simbolo di percentuale alla fine della stringa print
. Non riesco a capirlo.Come aggiungo un simbolo% al mio script Python
total = 0
counter = 0
while True:
score = int(input('Enter test score: '))
if score == 0:
break
total += score
counter += 1
average = total/counter
print('The average is:', format(average, ',.3f'))
Cosa significa 'formato'? –
Possibile duplicato? http://stackoverflow.com/questions/10678229/how-can-i-selectively-escape-percent-in-python-strings –
@PeterWood E 'una [funzione built-in] (https://docs.python.org /3/library/functions.html#format). – poke