Ask coding questions

← Back to all posts
Birthday blessing
EuniceYeoh (1)

I know very very little of python only, but I’ve made this with python for my friend as a birthday gift. Can anyone tell me how to improve it, either how to use loop to make the code shorter or any new idea I can add in. The words I type inside are in Chinese sorry for any inconvenience but still thank you!

Answered by OldWizard209 (1538) [earned 5 cycles]
View Answer
OldWizard209 (1538)

This is really amazing but very very repetitive. There are ways you can improve this. For example with every for loop, you can just create a function:

def print_out(list_name):
    for x in list_name :

... # so on
EuniceYeoh (1)

@OldWizard209 omg thank you i will do the correction as much as possible. Thank you!!

OldWizard209 (1538)

Would mind marking my answer as correct? @EuniceYeoh

EuniceYeoh (1)


btfuss (177)

That's so sweet! Maybe add a rainbow birthday instead of one color.

EuniceYeoh (1)

@btfuss ok i will try to do that as soon as possible thanks!