0
with a problem that would be the following, the problem asks to order the numbers in the order you typed them and then do in reverse order, someone can give me a light, the code is more or less this:
ps: not in list.
this cont is pq tbm has q show the media and how many were typed.
(i am using while true, pq in problem it to terminate qnd type a negative number)
cont = 0
while True:
notas = float(input("Informe a nota: "))
if notas == -1:
break
cont += 1
print(cont)
You can use an array?
– Wictor Chaves
Not really, because we’re not there yet
– punkoco
You’re not doing anything with
notas
. You can’t show the bills if you don’t store them. I don’t see how to do this without a list, except creating several variables beforehand, one for each note (but then you don’t know how many notes will be typed)– Pedro von Hertwig Batista
I’m also finding it strange to do this without list, but well, I think I’ll do with list with list I just did WITH LIST LOOKS LIKE THIS: cont = sum = media = 0 order = [] inverse = [] while True: notes = float(input("Enter note: ")) if notes == -1: break order.append(notes) inverse.append(notes) cont += 1 sum += notes media = sum / cont print(cont) print(order) (inverse[:print-1]) print(sum) print(media)
– punkoco