Thursday, August 18, 2022

[FIXED] How can I count the outputs of a while loop in python?

Issue

I would like to be able to insert a line of code that counts the number of times the output is "watch".

This is the picture of my current code


Solution

Try this one:

counter = 0
while Amzn > 1000:
    counter+=1
    print("Watch")
    Amzn = Amzn - (Amzn*.0103)
else:
    print("buy")
print(counter)


Answered By - Gabio
Answer Checked By - Terry (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.