Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this next exercise, you'll need to complete the function gen_pattern, which, when called with a string of length 1, will generate an ASCII art

For this next exercise, you'll need to complete the function gen_pattern, which, when called with a string of length 1, will generate an ASCII art pattern of concentric diamonds using those characters. The following are examples of patterns returned by the function:

gen_pattern('XY') ..Y.. Y.X.Y ..Y.. 
> gen_pattern('WXYZ') ......Z...... ....Z.Y.Z.... ..Z.Y.X.Y.Z.. Z.Y.X.W.X.Y.Z ..Z.Y.X.Y.Z.. ....Z.Y.Z.... ......Z...... 

please make all indentations clear in the solution code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions