PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, August 18, 2022

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

 August 18, 2022     count, output, python, while-loop     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing