The loops of spring.

in #steempress6 years ago (edited)

April fools day is a little less than 25 hours away. It's been about two months since I posted anything, and even longer since I've rambled anything in this Python diary. The reason is very simple. There was just too much new material I've been going through. Each time I would get a question, it would be answered immediately on the next page of the course! With such a huge amount of information in such a short period of time, I learned Python lists, loops, and nested loops. Then right when I started on more string methods my brain started forgetting some of the new material. Clearly, the limit of my short term memory has been reached (^^;) How embarrassing... I had to slow down and the last three weeks were spent looking for different examples and exercises to go through.

I've also started asking questions on different forums. The community is absolutely amazing and everyone is super helpful and kind. One of my friends even "held my hand" while I was trying to solve one particularly annoying loop problem. Of course, some explain things better than others.

The most interesting thing happened today. I asked for an explanation of an example at the Codeacademy forums several weeks ago:

"Why does the example use after an element in the list:"
for word in words: if word[0] == ‘@’: usernames.append(word)

"Is it because it’s a way to check the string in the list elements?"

Now some other Python learner stumbled upon this example and couldn't understand it too. He or she saw my question but couldn't understand the reply I had received and asked me for help. It should be mentioned that the example in question appears in the section with lists and loops, before strings are explained.

That was also the moment I realized I have to ask better questions. Not just ask for a confirmation of something I assume might be true (-_-;).


It's one of the habits I have from learning foreign languages. I find it saves a lot of time. When my vocabulary reaches a certain amount of words, I start guessing word meaning from situations and context. It can be disastrous and leads to misunderstandings. Sometimes those can last years. But it still works faster than looking for a word in the dictionary each time. Plus the part, when someone around realizes I'm using a word wrong, can be fun and very memorable.

cherry blossoms


In the meantime, sakura is in full blossom again!


It happens every year, and each time is as exciting as the previous.

def cherry_blossom_viewing_party(picnic, drinks):
    for beer in picnic:
      if drinks == beer:
        return Yay!
    return False
I know the above loop is badly worded, but a hanami (cherry blossom viewing party) without beer is like an ocean without fish ^^

 

Sort:  

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

You received more than 500 upvotes. Your next target is to reach 1000 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

3 years on Steem - The distribution of commemorative badges has begun!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

for word in words:
if word[0] == ‘@’:
usernames.append(word)

It looks backwards to me, i don't understand :)

Are we adding'@' to the start of a username?

Ah damn i should write clearer eh eh!

Maybe :P

You can still explain further here also?!

even though you are clearly making fun of me xD let me entertain you.
They wanted us to create a list of the usernames mentioned in a list of strings. The loop checks the first indice of each string for “@“ which indicate a username in that list (^^;)
Whenever the loop finds such a string, it adds it to a different list. The one made only for usernames.

Better? xD

Yes that is better :)

Not much code to traverse a string, hunt for usernames, and add to a new list!

so the string could be 'nope, @abh12345, dggggg@ned'?

will ned (with @) still get moved to the new list?

❌ that won’t work because “@“ has to be at index 0 for the string to be deemed a username 💮

so is the first list an array of strings, some are usernames and some aren't?

お久しぶりです!
勉強、がんばってるようですね!
今年もまた桜の季節がやってきました^^

Spring always tends to make me !sneeze :(


@suesa get better soon 😚

You have been infected by the King of Disease!

Will you quarantine yourself?

Or will you spread the plague?

King Of Disease

As a non coder I am clueless as to what you're talking about it, but being an american that was exposed to spanish and now lives in Malaysia I understand about the learning curve of foreign languages. Where I live now there are at least 4 languages I deal with daily. English no problem, Bahasa melayu I'm OK, hokkien big problems, and finally Tamil which is hopeless for me, even with a Tamil wife lol..

I just never even considered coding but I'm interested in tau, are you familiar with this? Look into it if not, it's basically human to ai to human consensus using what seems like a logic based code that seems to have a more universal appeal as far as languages go.

Posted using Partiko Android

Oh thanks! I’ll look into it
!sneeze

You have been infected by the King of Disease!

Will you quarantine yourself?

Or will you spread the plague?

King Of Disease

Congratulations @anmitsu! You received a personal award!

Congratulations! You've been among the most infectious people during the April Fools' Steem Plague in 2019! organized by @suesa

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

!bookkeeping drugwars

Hi @anmitsu!

drugwars

Received:

  • 91.249 STEEM from daily
  • 35.026 STEEM from heist
  • 0.000 STEEM from referral

Spent:

  • 105.068 STEEM

Total:

  • 21.207 STEEM

First transfer was before 53.06 days.
Your ROI per day is 2.27 % and you are earning approx. 2.38 STEEM per day.

ROI when taking only the last 5 days into account

Your ROI per day is 0.48 % and you are earning approx. 0.51 STEEM per day.

Uhmmm. I only know very basic html and css and now markup too. That's all. Bow. 😂😂😂

Imma get me some BEER soon. Haha.

Wait, what's your steempress blog? There's no link at the bottom...?

Hey @artgirl!

Yeah me too, but there are some things I’d like to automate, so python is the tool to do it.
I had to move my hosting so have to setup the steempress again lol.

Oh I see...

Posted using Partiko Android

@artgirl it’s anmitsu.club if you are still interested, but I had only this one post on the new hosting. everything else is backed up on Steem :)

Ok. Haha was just curious.

Posted using Partiko Android

Hi there. Thanks for the upvote and I followed you, please follow me too so we can be friends here in Steemit community and keep in touch with each other.

Posted using Partiko Messaging


Congratulations @anmitsu!
You raised your level and are now a Minnow!

Do not miss the last post from @steemitboard:

SteemitBoard - Witness Update
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Congratulations @anmitsu! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

The new SteemFest⁴ badge is ready
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Congratulations @anmitsu! You received a personal award!

Thank you for the witness votes you made to support your Steem community and for keeping the Steem blockchain decentralized

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

Use your witness votes and get the Community Badge
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

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

You distributed more than 3000 upvotes.
Your next target is to reach 4000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Happy New Year - Feedback from the first Hive Power Up Day of 2022
PUD - PUH - PUM - It's all about to Power Up!
Support the HiveBuzz project. Vote for our proposal!