I am looking to print values that were obtained through a previous loop:
for example:
x=10
while i < num_of_guesses:
y = int(input("enter y: ")
print(x*y)
i += 1
My goal is to print every value obtained again, so the output would look something like this
enter y: 1
10
enter y: 2
10
20
enter y: 1.5
10
20
15
The problem I’m having is figuring out a way to print the 10 and 20 (in this example) again.
Any solution?
>Solution :
Try this:
arr = []
while (i < num_of_guesses):
y = int(input("enter y: "))
arr.append(x*y)
for m in arr:
print(m)
i += 1