top of page

Day 1

  • Writer: supriyamalla
    supriyamalla
  • Sep 29, 2020
  • 1 min read

Hi There!


Today, I was thinking - that I should begin my baby steps towards coding again! It's fun and along the way I would be reading about Statistics and Python! I will diligently spend at least 5 minutes of my time towards building my foundation, and I loved this initiative of "66DaysOfData" (follow it on twitter and LinkedIn)



Setting a plan for myself to complete this micro course by this week, code along with me!

So, today, I:

  1. Learnt about the basic assignment operations in the first section

  2. Next, learnt about functions, calling them and provide optional arguments

For ex:

Three candy-sharing friends Alice, Bob and Carol tried to split candies evenly. For the sake of their friendship, any candies left over would be smashed. For example, if they collectively bring home 91 candies, they'll take 30 each and smash 1.

Below is a simple function that will calculate the number of candies to smash for any number of total candies.

Modify it so that it optionally takes a second argument representing the number of friends the candies are being split between. If no second argument is provided, it should assume 3 friends, as before.

def to_smash(total_candies,friends_count=3):
"""Return the number of leftover candies that must be smashed after distributing the given number of candies evenly between n friends (3 by default)""".
 return (total_candies%friends_count)
 to_smash(10)

Also learnt about debugging code and common errors and help() function.


Hey, this was fun! We'll continue with this micro course tomorrow.


Comments


Post: Blog2 Post

Subscribe Form

Thanks for submitting!

©2020 by Learn Data Science with me. Proudly created with Wix.com

bottom of page