Skip to content

augelloantonio/xmas_tree_2019

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Institute Christmas Challenge

This is Code Institute Christmas Challenge.

The Challenge

The description of the challenge is as follow:

The Challenge

My Solution

I use Python to solve this challenge.

Solution

My solution is based on a While Loop. I assigned different variables and made the characters I need to made the tree:

left_tree = '/'
right_tree = '\\'
bar = '_'
star = '*'
starting_space = ' '*(max-1) # This is the left side space 

To meet my criteria I used a While Loop assigning as range my 'max' variable, this way it is possible to change as well the size of the tree.

Tree Basement

To made the tree basement I assigned the variables as follow:

bar_vertical = '|'
space_star = ((max*2)-1) * '*'
full_line = ((max*2)-1) * '_'
half_line = 10 * '_'
left_side = (max-5) * ' '

The basement will always be on the middle of the tree because it follows the size of the max value ('left_side' variable).

Ho to run my code locally

  1. Copy the repo: $ git clone https://github.com/gello94/xmas_tree_2019

  2. Run the .py file: $ python xmas_tree.py

DO you want to change the size of the tree? Just change the 'max' variable value.

Add some lights to the tree If you want to add some lights to the tree (represented as *) just follow the comments in the code where the space ' ' need to be changed with '*'.

The result will be as follow:

Solution

About

Code Christmas Challenge - Code Institute

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages