calthoff / self_taught

This repository contains the exercises for "The Self-Taught Programmer: The Definitive Guide to Programming Professionally."
http://theselftaughtprogrammer.io
267 stars 226 forks source link

while-loops with format method... #31

Closed samseesdata closed 4 years ago

samseesdata commented 4 years ago

Hi there, The while-loop example given executes fine without the format method, I was hoping for some explanation as to why you used the format method here instead of just print(x)? When I use print(x) it returns the same result.

http://tinyurl.com/j2gwlcy

x = 10 while x > 0: print('{}'.format(x)) x -= 1 print("Happy New Year!")

Thanks- Sam

calthoff commented 4 years ago

No reason just didn't think of that at the time.

On Wed, Oct 23, 2019 at 9:40 PM samseesdata notifications@github.com wrote:

Hi there, The while-loop example given executes fine without the format method, I was hoping for some explanation as to why you used the format method here instead of just print(x)? When I use print(x) it returns the same result.

http://tinyurl.com/j2gwlcy

x = 10 while x > 0: print('{}'.format(x)) x -= 1 print("Happy New Year!")

Thanks- Sam

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/calthoff/self_taught/issues/31?email_source=notifications&email_token=ACAPZT7IW36M6KLCTD4TBY3QQERKHA5CNFSM4JEOU4NKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HT76URA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAPZTZ76I6YYR2N2DWIONLQQERKHANCNFSM4JEOU4NA .

-- Cory Althoff www.goselftaught.com http://www.goselftaught.com