Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
creating a rectangle
#4
I would use join. Also, it is better to loop directly over the list rather than over the indexes of the list:

for row in R:
    print(' '.join(row))
If you haven't covered the join string method and aren't allowed to use it, you could build the string up piece by piece, rather than printing it piece by piece. Then at the end of the inner loop, print the stripped version of it to get rid of the trailing space.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
creating a rectangle - by sakkokakko - Jul-10-2019, 02:04 PM
RE: creating a rectangle - by ichabod801 - Jul-10-2019, 02:12 PM
RE: creating a rectangle - by sakkokakko - Jul-10-2019, 10:44 PM
RE: creating a rectangle - by ichabod801 - Jul-11-2019, 01:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Rotated Rectangle overlap using Shapely pyNew 0 1,737 Feb-25-2021, 04:54 AM
Last Post: pyNew
  Return draw.rectangle pixel coordinate data to .csv file CephloRhod 0 2,409 May-20-2020, 10:37 AM
Last Post: CephloRhod

Forum Jump:

User Panel Messages

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