Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e511b26

Browse files
committed
updations in pattern programs
1 parent 104c5ff commit e511b26

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎Programs/P05_Pattern.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,24 @@ def pattern5(level):
8888
print()
8989
pattern5(userInput)
9090
print()
91+
92+
'''
93+
following is the another approach to solve pattern problems with reduced time complexity
94+
95+
for
96+
97+
*
98+
**
99+
***
100+
****
101+
*****
102+
'''
103+
104+
num = int(input('Enter number for pattern'))
105+
pattern = '*'
106+
string = pattern * num
107+
x = 0
108+
109+
for i in string:
110+
x = x + 1
111+
print(string[0:x])

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /