#100DaysOfPython Day 1: Hello World, Data Types & Strings
My mission is to always encourage people to not be afraid to be open about learning something new. We are all a novice at something.
My plan is to make it a nightly habit to convert my handwritten notes into blog posts. I’m treating the series as merely a digital collection of notes to share with the community as opposed to traditional tutorials. I encourage everyone of all experience levels to try as well. It’s a great way to review and solidify your learnings as well as great practice for bettering your communication skills for technical interviews
Update: My collection of notes will always be updated as I learn more things. They are notes, not comprehensive tutorials. I’m merely posting as I actively learn. I do not claim to be a Pythonista, I am not an expert.
So after installing Anaconda, I started writing Python code using the Jupyter Notebook that’s typically located on localhost:8888.
You use the print() function to print “hello world” and then boom. That’s it.
|whole numbers like 1, 2, 3
|numbers with decimal point like 100.00 or 30.2
|Ordered sequence of characters that uses double or single quotes like “hello” or ‘hello’
|ordered sequence of objects; similar to JS arrays
|unordered key:value pairs
|ordered immutable sequence of objects
|unordered collection of unique objects
|logical value either True or False
|2 + 2
|2 – 2
|2 / 2
|2 * 2
|To return the remainder after a division
|5 % 5 = 0
The type() function is a built-in method in Python that lets you check the data type of a variable in case you ever forget!
Notes about strings will be continued in Day 2 of the #100DaysOfPython series and that will go more in depth about slicing, indexing, print formatting and more which I’m exciting about blogging about tonight because I definitely fucked up on it lol.
A string is an ordered sequences of characters, meaning each character within a string has its own ordered position. This allows you to easily grab or a character within a string using index notation
Character: h e l l o
Index: 0 1 2 3 4
The whitespace within a string count as a character too
Indexing allows you to grab a single character from a string using index notation. Remember space within the string counts as characters!
The len function checks the length of a string.
Definition: Special commands inside of your string.
To create a tab in your string use /n
Allows you to grab the last used letter in a string
Grabs a subset or group of characters in a string
Remember start:stop:step !
Start- A numerical index for starting the slice
Stop- index you will go up to but dont include
Step- size of the leap you take
- Lists and Tuples
- Sets and Dictionaries