Python Forum
Christmas Tree (Why is it like that ?)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Christmas Tree (Why is it like that ?)
#1
Hello everyone,
I'm trying to do a christmas tree but I encouter some problems...


stairs = int(input("Number of stairs for the Christmas Tree :"))
space = " "
star = "*"
stars = " * "
stars_branch = " | "
nbre_line = stairs*4
nbre_line_star = 7
size = nbre_line - 1
nom_ligne = 0
space = " "
def stairs_tree(a) :
    size = nbre_line - 1 - i
    for line in range(5):
        nbre_branch = 2*a * line - 1 
        print(space * size + star * nbre_branch)
        size -= 1
for i in range( stairs +1) :
    stairs_tree(i)
    size = nbre_line -1
And I find this: *
////////***
///////*****
//////*******

////////***
///////*******
//////***********
/////***************

///////*****
//////***********
/////*****************
(don't mind the slash)

Could you please help me remove the space and put it neatly ?
Thanks !
buran write Dec-17-2020, 03:29 PM:
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
Reply
#2
Pls use python tags so we can see the intended indentation.
Is it possible that there is no "space" , but each of your first print lines evaluates to nothing being printed. Hence an apparent "space".

Paul
GaivSo likes this post
Reply
#3
Sorry it's my first time so I'm a bit lost, where I can put theses "tags" ?
Edit: Wait, nah nervermind sorry.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Christmas and other occasions GalaxyCoyote 4 2,517 Jul-18-2019, 09:51 PM
Last Post: GalaxyCoyote
  Help me write a Christmas Program! marienbad 3 2,382 Dec-26-2018, 12:57 PM
Last Post: marienbad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020