Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Programming Question, Triangle of stars using definition of functions Write functions triangleNW(n), triangleNE(n), triangleSW(n), and triangleSE(n) that print nn triangles of asterisks (the star

Python Programming Question, Triangle of stars using definition of functions

Write functions triangleNW(n), triangleNE(n), triangleSW(n), and triangleSE(n) that print nn triangles of asterisks (the "star" character *) with a right angle at the named corner. For example, triangleNW(4) would print

**** *** ** * 

while triangleNE(5) would print

***** **** *** ** * 

Use these functions to write a program that has the user ask for a value of n, then prints the following figure composed of nn triangles (the sample is for n=4):

**** *** ** * * ** *** **** **** *** ** * * ** *** **** 

(Hints: you can print a row of asterisks by using string multiplication "*" * n, for example. Your triangle functions will then consist of for loops that print one row of asterisks at a time. For the NE and SE triangles, remember that you can print multiple spaces using the same technique: " " * n

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_2

Step: 3

blur-text-image_3

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

Intelligent Image Databases Towards Advanced Image Retrieval

Authors: Yihong Gong

1st Edition

1461375037, 978-1461375036

More Books

Students also viewed these Databases questions

Question

d. Who are important leaders and heroes of the group?

Answered: 1 week ago