anmitsu avatar

Learning to code in Python 3 - diary #1

anmitsu

Published: 16 Oct 2018 › Updated: 16 Oct 2018Learning to code in Python 3 - diary #1

Learning to code in Python 3 - diary #1


LEARNING TO CODE  

in PYTHON 3


Hi there! This is my side blog where I'm going to write about learning to code and my quest to start making picture books for kids :D
Tips and hints are welcome ^^
~Anmitsu

    Two weeks ago  

I've started on to learn Python 3.
I have to say I never expected it to be that exciting. Years ago I tried to learn JS with Code Academy, but couldn't get past some things. That course seemed extremely confusing and I gave up quickly. I did play a simple coding game, I think it was from Google, where you had to get the pin from point A to point B using the route provided. I'd race a friend who was an actual programmer, to see who could do it in fewer steps.
Even though I'd beat her quite often, it never went further than that.

After a certain life event, my brain was shouting that it needs to learn and crack something. And while I wasn't sure what to learn, I felt like doing some logic, which is super fun. One thing led to another and here I am, learning to code in Python 3 ^^.


So while taking this Python course I keep running into these Tasks, where I'm not always sure or perhaps, better to say, I don't always understand what they want me to do exactly 🤔🤔🤔🤔🤔🤔🤔🤔

02_1_3_2.jpeg

So this one I did without much of a problem because there was an example code.

 # [ ] add a 3rd period parameter to make_schedule
def make_schedule(period1,period2,period3):
    schedule = '[1st] ' + period1.title() + ', [2nd] ' + period2.title() + ', [3rd] ' + period3.title()
    return schedule
student_schedule = make_schedule("math", "history", "science")
print("SCHEDULE: ", student_schedule)

But this Optional part makes me scratch my head

# [ ] Optional - print a schedule for 6 classes (Tip: perhaps let the function make this easy)

So I went about it adding more parameters to the function and adding one more variable

def make_schedule(period1,period2,period3,period4,period5,period6):
    schedule = '[1st] ' + period1.title() + ', [2nd] ' + period2.title() + ', [3rd] ' + period3.title()
    schedule_6 = schedule + ' [4th] ' + period4.title() + ' [5th] ' + period5.title() + ' [6th] ' + period6.title()
    return schedule_6

student_schedule = make_schedule("math", "history", "science","art","history of Star Wars","astronomy")
print("SCHEDULE: ", student_schedule)



Since there is no answer provided
I'll scratch my head a little more and go to the next task.

Ideas and explanations welcome :D

~ Anmitsu

Leave Learning to code in Python 3 - diary #1 to:

Written by

learning to code :D

Read more #learning posts


Best Posts From anmitsu

We have not curated any of anmitsu's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From anmitsu