Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started