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

User Sohum
by
8.2k points

1 Answer

6 votes
#!/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!


User Jeyan
by
9.4k points