The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
FrEaK (1) [Avatar] Offline
#1
Here is how I solved this problem without a nested loop! Just be sure to tab the for loop block code!


import time

cdtime = int(raw_input("How many seconds? "))
stars = cdtime

for i in range (cdtime, 0, -1):

print i, (stars * "*")
time.sleep(1)
stars = stars - 1

print "Blast off!"
warren.sande (211) [Avatar] Offline
#2
Re: Chap. 11 Prob. 2 Different Soloution
Good One! You used the same trick we showed in Chapter 1:

print "hello" * 20

Nice to see you remembered that and made the connection to this problem.


Regards,
Warren Sande