Pattern #1 with input string on Python
Pattern #1 with input string
Hi friends
Welcome already we seen pattern #1 (Only star print)
Today, similar pattern type,but there pattern format is given input
Like if you give input is PyKAR, pattern is:
-------
P
Py
PyK
PyKA
PyKAR
------
Similarly, you can give any input...
CODE:
b = input('Enter name: ')
a = len(b)
d = list(b)
for i in range(a):
for j in range(i+1):
print(d[j],end='')
print()
----
#This code for Reverse input pattern
b = input('Enter name: ')
a = len(b)
c = ''
for i in b:
c = i + c
d = list(c)
for i in range(a):
for j in range(i+1):
print(d[j],end='')
print()
-----
By
PyKAR
PyKAR
Comments
Post a Comment