String Asterisk Zig Zag Pattern

67
0
Home Programs String Asterisk Zig Zag Pattern

The program must accept a string S as the input. The program must print the desired pattern as shown in the Example Input/Output section.

Boundary Condition(s):
2< Length of S <= 100

Input Format:
The first line contains S.

Output Format:
The lines contain the desired pattern as shown in the Example Input/Output section.

Example Input/Output 1:
Input:

abcde
Output
abcde
abcd*
*bede

abc**
**cde

ab***
***de

a****
****e
*****
*****

Example Input/Output 2:
Input:
How
Output
How
Ho*
*OW

H**
**w
***
***

a=input().strip()
print(a)
for i in range(1,len(a)): 
	print(a[0:len(a)-i], end="")
	for k in range(i): 
		print("*", end="")
	print()
	for k in range(i):
		print("*", end="")
	print (a[i:])
print('*'*(len(a)))
print('*'*(len(a)))
Hephzibai
WRITTEN BY

Hephzibai

Hephzibai is a driven third-year student at St. Joseph's Institute of Technology, specializing in Computer Science and Engineering. With a keen interest in data science and also in fullstack.
One of my greatest strengths lies in my programming skills, which I've honed through countless hours of practice and participation in coding challenges. Platforms like Skillrack, HackerRank, and others have been my playgrounds, where I've tackled a wide range of problems with creativity and determination.

Leave a Reply

Your email address will not be published. Required fields are marked *