Python Forum
John Guttag Book - Finger Exercise 3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
John Guttag Book - Finger Exercise 3
#4
Hello pritesh,

I've purchased the book couple of days ago so can be prepared for my Mathematics and Computer Science course starting from September / October.

Thought I'd share my method!

numXs = int(input('How many times should I print the letter X?\n'))
counter = 0
toPrint = ''

while counter < numXs:
    toPrint += 'X'
    counter += 1
    
print(toPrint)
I used a counter instead of changing the value of numXs.
Reply


Messages In This Thread
John Guttag Book - Finger Exercise 3 - by pritesh - Jan-29-2018, 07:02 PM
RE: John Guttag Book - Finger Exercise 3 - by collectorKim - Aug-15-2018, 03:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  John Guttag Book Finger Exercise 2. pritesh 6 10,829 Feb-09-2020, 08:08 PM
Last Post: Larz60+
  John Guttag Python Book Finger Exercise 5 pritesh 0 8,217 Mar-04-2018, 09:08 PM
Last Post: pritesh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020