Python Forum
Pattern Require Last Line Print() why?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pattern Require Last Line Print() why?
#5
(Aug-08-2020, 09:08 AM)Intr0spective Wrote: Hi,

The below is my interpretation of the code, I am obviously not saying that there is anything wrong with the OP's code.
I actually learnt a lot about print() tinkering with his code as well as for ndc85430 reply.

"""Sat 08/08/2020 at 09:02, my attempt at OP's code from a forum question."""

def get_pattern(num):
    """Return a list of pattern based on supplied argument."""
    pattern = []
    for i in range(0, num):
        pattern.append(num)
    return pattern

for n in range(1, 6):
    #pattern = get_pattern(n)
    #print(*pattern, sep='')
    print(*get_pattern(n), sep='')
Can someone advise if my code is ok or there is something that should be done differently?
Kind of like a simple feedback?
Well You Had A Good Approach!
Using Def Function To Print Patterns
Reply


Messages In This Thread
Pattern Require Last Line Print() why? - by Harshil - Aug-08-2020, 06:48 AM
RE: Pattern Require Last Line Print() why? - by Harshil - Aug-08-2020, 04:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with spliting line in print akbarza 3 445 Jan-23-2024, 04:11 PM
Last Post: deanhystad
  Why doesn't list require global keyword? johnywhy 9 943 Jan-15-2024, 11:47 PM
Last Post: sgrey
  Print the line before the corrent line tester_V 9 1,637 Nov-18-2022, 08:39 AM
Last Post: Gribouillis
  Print to a New Line when Appending File DaveG 0 1,248 Mar-30-2022, 04:14 AM
Last Post: DaveG
  If match not found print last line tester_V 2 2,934 Apr-26-2021, 05:18 AM
Last Post: tester_V
  print a line break in writelines() method leodavinci1990 1 6,541 Oct-12-2020, 06:36 AM
Last Post: DeaD_EyE
  Print characters in a single line rather than one at a time hhydration 1 2,064 Oct-10-2020, 10:00 PM
Last Post: bowlofred
  How to print string multiple times on new line ace19887 7 5,861 Sep-30-2020, 02:53 PM
Last Post: buran
  Require Some Suggestions gouravlal 2 1,913 Jul-27-2020, 06:14 AM
Last Post: gouravlal
  print only last matched line tester_V 24 6,692 Apr-30-2020, 05:16 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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