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

The resistance of a wire, R, varies directly with the length and inversely with the square of the diameter. If the resistance is 7.5 ohms when the wire is 6 met
1. In order to finance the purchase of their new home, Dr. Gary Adams and his wife, Becky, will secure a loan at 6.75 % for 15 years. If their home costs
find an equation for the line that passes through the points (-2,1) and (2,3)
Now assume that the charge is emitted with velocity v0 in the positive y direction. Between the origin and the screen, the charge travels through a constant el
P = aW + b (make w the subject of the formula)​
tions below. Eddie, a home health aide, takes a urine sample from his client, Mr. Velasquez. When Eddie finishes, he accidentally knocks the container onto the
A photo copier is making reduced copies of a photo that measures 25 cm in height the height of the first copy is 80% of the height of the original another copy
What is the correct way of writing X is less than five or greater than or equal to -3
Geometry 1 Lessons 5-4 and 5-5
Fuihvhiicgijhcguhiyfui