Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
triangle numbers
#6
Replacing "spaces" is an exercise left to the reader. I would read about the str datatype and what methods it supports. I bet there is a method for padding a string to some width. I'd also do some research on f'string formatting. There is a way to set the width of a string when it is printed. Very useful for printing out tables and having the columns line up. There is also an operator that you can use on strings to make a longer string by concatenating a short string some multiple number of times.
Reply


Messages In This Thread
triangle numbers - by Woody_MC_2022 - Sep-24-2022, 09:10 AM
RE: triangle numbers - by deanhystad - Sep-24-2022, 09:35 AM
RE: triangle numbers - by Woody_MC_2022 - Sep-24-2022, 03:01 PM
RE: triangle numbers - by deanhystad - Sep-24-2022, 03:37 PM
RE: triangle numbers - by Woody_MC_2022 - Sep-24-2022, 03:52 PM
RE: triangle numbers - by deanhystad - Sep-24-2022, 08:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fill a value in triangle shape in Matrix lynx 0 1,952 Dec-07-2019, 06:32 AM
Last Post: lynx
  Hollow triangle-drawing characters param error. phob0s 4 2,649 Jul-31-2019, 08:18 AM
Last Post: phob0s
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,843 May-09-2019, 12:19 PM
Last Post: Pleiades
  Printing out a triangle using nested for loops MrGoat 12 6,756 Jan-16-2019, 07:21 PM
Last Post: ichabod801
  Triangle: max path sum Mateoo 1 2,986 Jan-10-2019, 09:16 PM
Last Post: stullis
  Area of a triangle OmarSinno 8 5,911 Sep-25-2017, 08:10 PM
Last Post: OmarSinno

Forum Jump:

User Panel Messages

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