Learning to code in Python 3 - diary #1

in #learning6 years ago (edited)



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

Sort:  

Hey @anmitsu, which tutorial or course are you using? Is it freely available?

If I could follow along with the source material, I'd have a better idea of the things to suggest. I don't want to suggest something too advanced at such an early stage in the course.

For now, I think your solution looks fine, considering what it is. There's a more advanced way of solving the problem, but as we discussed elsewhere, I don't want to risk missing the point of the exercise.

hi @lemony-cricket :D
thanks for looking out for me and the delegation. It's impossible to even reply before the RC recharge.
It's a free edx course from microsoft.
https://courses.edx.org/courses/course-v1:Microsoft+DEV236x+3T2018/course/

since there are obviously more ways to get the same output, I keep questioning if that's how they want me to do it, or if I'm missing something.

I had absolutely no idea what to delegate SP-wise, and it looks like I overdid it a little:

overdid.png

Oh well. I'll pull it back in a while, when you've had a few good payouts and the account is self-sustaining.

Congratulations @anmitsu! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published your First Post
You got a First Vote
You made your First Comment
You got a First Reply
Award for the number of upvotes received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemitBoard Ranking update - Steem Power, Followers and Following added

Support SteemitBoard's project! Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64093.86
ETH 3123.80
USDT 1.00
SBD 3.94