emikey emikey
  • 20-10-2017
  • Computers and Technology
contestada

I am having trouble figuring out how to write a while loop in Python. Can someone help me?

Respuesta :

zrh2sfo
zrh2sfo zrh2sfo
  • 20-10-2017
#!/usr/bin/python
 
count = 0
while (count < 9):
    print 'The count is:', count
   count = count + 1

print "Goodbye!"

The output should look like this:
The count is: 0
The count is: 1
The count is: 2
The count is: 3
The count is: 4
The count is: 5
The count is: 6
The count is: 7
The count is: 8
Goodbye!


Answer Link

Otras preguntas

Two people started from the same point at the same time and traveled in opposite directions. One traveled at 60 mph and the other at 50 mph. How long will it ta
Leon has a piece of cheese shaped like a triangular prism that he needs to wrap in plastic wrap. What is the minimum amount of plastic wrap that he needs to cov
How did the headright system benefit planters?
Worksheet investigations: what can an owl pellet reveal about diet? answers
The government provides a number of public welfare services, including?
The Khmer Rouge was a regime ruling this nation in the 20th century. A. Vietnam B. Laos C. Cambodia D. China
Who fought in the war of 1812? A. Andrew Jackson B. Arthur Wellsley C. Otto von Bismarck D. Napoleon
The process by which planetesimals combine with other planetesimals are called
You are designing a large fish tank for your fish. The length will be 1 yard 3 inches, the width will be 1.5 feet, and the height will be 20 inches. find the vo
In Gordimers 1959: What is Apartheid? What is the authors purpose?