Week 1 Day 1
===
###### tags: `Week 1` `Basic Python`
# Week 1 Day 1
1) Introduction:
* What is data?
* Qualitative and Quantitative:
* Qualitative data is descriptive information
* Quantitative data is numerical information
* Structured data vs Unstructured data:
* Structured data: data organized by table
* Unstructured data: data not followed any storing structure (picture, audio, email)
* Unstructured data have been increasing because of social media
* Data Science:
* Extract insights from messy data
* Data Analyst
* Data Engineer
* Data Scientist
2) Lab time:
* 1.1b_LAB1_BasicPython_01.ipynb
# Question 2: Which snippet of code can swap the value of a and b ?
* Learn a new syntax to swap value of 2 variable:
course_amount = 4
course_small = 7
course_amount, course_small = course_small, course_amount
print(course_amount)
print(course_small)
# Question 4: Write a simple function that will calculate the number of candies to smash for any number of total candies
* Learn new way to define a function with receive one or many parameter:
* By assigning one of parameter to None:
Reference:https://www.earthdatascience.org/courses/intro-to-earth-data-science/write-efficient-python-code/functions-modular-code/write-functions-with-multiple-and-optional-parameters-in-python/
def smash_candies(x,y=None):
if y == None or y < 3:
return (x%3)
else:
return (x%y)
# Question 6: Find out one limitation of Python for floating point arithmetic:
Reference:https://stackoverflow.com/questions/36541776/floating-point-subtraction-in-python
# Question 8: Facing issue **'int' object is not callable**
* Reason: Define a variable sum which bind the build-in function sum() of python library
* Search syntax: https://www.google.com/search?q=%27int%27+object+is+not+callable&oq=%27int%27+object+is+not+callable&aqs=chrome..69i57j0i512l9.406j0j15&sourceid=chrome&ie=UTF-8
* Reference: https://careerkarma.com/blog/python-typeerror-int-object-is-not-callable/#:~:text=The%20%E2%80%9CTypeError%3A%20'int',round()%20or%20sum()%20.
https://stackoverflow.com/questions/9767391/typeerror-int-object-is-not-callable
* 1.1c_W01_D1_LAB2_BasicPython.ipynb:
Note:
# Print out all the planets that comes before Mars (including Mars) but backward
```
planets = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune']
planets[3::-1]
```
# Question 7: write a function that will return the list of numbers from n to m which is divisible by 5
* Learn about isnumeric() to check if characters are numeric
* Reference: https://www.w3schools.com/python/ref_string_isnumeric.asp
# join() function sewing a list of strings up into one long string, using the string it was called on as a separator.
* Sewing with ' ' is a separator
``` ' '.join()```
# strip() function remove spaces at the beginning and at the end of the string
Reference: https://www.w3schools.com/python/ref_string_strip.asp
# isupper(), islower(), lower(), upper() in Python
Reference:
https://www.geeksforgeeks.org/isupper-islower-lower-upper-python-applications/