Return...return... python diary #4
Dear Diary,
I'm back :D Who would have thought that a cold at the end of October would lead to a surgery last week? I certainly didn't. Now I'm sitting at home with a tissue to stop a nosebleed. It's surreal. But now there is time to continue learning, and see how much had settled in my head.
Of course, the best way to check that would be to do one of the edX tasks... since they often omit some explanations and you have to do some guesswork/head scratching ^^;
Since I've started the conditionals and learned more syntax, the task reflects that as well and works as a brush up for some function stuff... Conditionals are quite easy to understand so far :D The problem of course again lies in the fact that I don't know functions very well yet.
Where do you use/add return inside a function with conditionals?
First I tried to write it like this (as per previous conditionals examples on edx):
Buuuut... yeah.... since I didn't add a return anywhere, the function returns None.
I tried to add it here and there for a while to see how it would go, but after giving up and googling the answer turned out to be a lot more trivial... Wha??? Is that where you stick <strmore: turn? Pretty anticlimactic, (-_-;) and sort of enlightening. Ha! I should play around more :B
Things that I learned about functions (and then noticed some more mistakes) this time are:
- The function above has a ton of mistakes in it xD
- You can use
one ofthe parameters inside the input (omg! why didn't I think of it myself and nobody told me?? :D) - Return works with strings without any extra blings around it (ohohohohoh)
- Functions can do something or give out a result.
- Don't use weird names for codes like deku_quiz.
- Codeacademy has better explanations than edX. edX is better for playing around blind and learning how to swim.
Any other tips or fun tasks with functions are appreciated :D huhuhu
(Of course, I made more mistakes than I thought and thanks to Andikki <3 I found most of them)~ Anmitsu
Posted from my blog with SteemPress : https://anmitsu.club/2018/12/07/return-return-python-diary-4/
Leave Return...return... python diary #4 to:
Read more #python 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
- The loops of spring.
- Make your feed filled with pancakes again! Join in the pancake battle.
- Python Practice
- Git, sudo and alias adventures on an updated macOS Sierra.
- Return...return... python diary #4
- Intro post - I like spaghetti 🍝
- Building bridges across eternity, borrowing books at Openlibrary.org
- testing the code insert
- test post 2 with images
- learning Python 3 diary#3
- Learning to code in Python 3 diary #2
- Learning to code in Python 3 - diary #1