Question: python: Write a program called christmas_tree.py that uses a for loop to draw a Christmas tree along the lines of the following: * /
python:
Write a program called christmas_tree.py that uses a for loop to draw a Christmas tree along the lines of the following:
* / \ / \ /_____\
The left edge of the tree is made up of / characters and the right edge is made up of \ characters, the base (between the two edge characters) is made up of underscores (_), and the top of the tree is an asterisk.
Take an odd-valued input of 3 or greater from the user representing the width if the base of the tree. For the example above, the value would be 7. If the user inputs an even number, give them another chance to input a different (odd) number.
An input of 3 would yield the following tree:
* /_\
An input of 9 would yield:
* / \ / \ / \ /_______\
Write a program called christmas_tree.py that uses a for loop to draw a Christmas tree along the lines of the following: __ The left edge of the tree is made up of characters and the right edge is made up of characters, the base (between the two edge characters) is made up of underscores), and the top of the tree is an asterisk. Take an odd-valued input of 3 or greater from the user representing the width if the base of the tree. For the example above, the value would be 7. If the user inputs an even number, give them another chance to input a different (odd) number. An input of 3 would yield the following tree: XV An input of 9 would yield: /_
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
