If you have any questions, comments or issues with this project please post them here!
Oh gosh. For some reason I thought the program should actually be counting down in the Day 63 challenge.
I see now, all examples counted up.
Anyway, here’s the code to “Count Down” that I scratched my head for many minutes to get… before checking the previous examples to see they… all count up.
bows triumphantly before his audience of 2
torn, beaten, dusty red theatre curtain parts dramatically
#test.py file
import random
num = random.randint(10,100)
def countdown():
for i in range(num, 0, -1):
print(i)
edit: and by “challenge” I just mean the “fix my mistakes”… which was very challenging. For me.
Hello. I tried this 63 project with the def pretty_print
. The problem I don’t know to resolve is at the list.
The pretty_print
looks like this:
def pretty_print():
for row in myevents:
print(f"{row[0]} : {row[1]}")
print()
The problem is that myevents is a list, and it’s not defined. If I put myevents=[ ]
, the main program doesn’t print anything, probably because in the secondary program the list is empty. How can I apply this pretty_print
function and recall it in the main program? Thank you.
I think what you want is this:
def pretty_print(my_events):
for row in my_events:
print(f"{row[0]}: {row[1]}")
print()
Thank you, it was exactly what I wanted. It worked perfectly.