#100DaysOfPython Day 1: Hello World, Data Types & Strings
Tags: todayilearned, python, 100daysofcode, beginners
Published: 2019-11-16 22:47:47

---
title: #100DaysOfPython Day 1: Hello World, Data Types & Strings
published: true
description: Growing collection of notes on Python
tags: #todayilearned, python, 100daysofcode, beginners
canonical_url: https://taeluralexis.com/blog/100daysofpython-day-1-hello-world-data-types-strings/
---
![link title](https://thepracticaldev.s3.amazonaws.com/i/tfmgk3o7b62r992yumzx.jpg)
# What Led Me To Choose Python As My 2nd Language and why blog?

Frankly, I needed a break from front-end development with JavaScript and wanted to dive deep into a new language. I love how Python is used practically everywhere from machine learning, robotics, fintech, freaking NASA, etc. My goals are to build bots that track the prices of products, create helpful developer tools snd get a better understanding of CS concepts and build full-stack projects. I could've easily done all of those things with JS but why not something different?

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

<strong>Update: </strong>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.

## The Journey to Hello World
![link title](https://thepracticaldev.s3.amazonaws.com/i/lugc0jzgnybwqa588x2v.png)

So after installing <a href="http://anaconda.com/download" target="_blank">Anaconda</a>, 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. 

## Data Types 

<table style="width:100%">
  <tr>
    <th>Name</th>
    <th>Data Type</th> 
    <th>Meaning</th>
  </tr>
  <tr>
    <td>integers</td>
    <td>int</td>
    <td>whole numbers like 1, 2, 3</td>
  </tr>
  <tr>
    <td>Floating point</td>
    <td>float</td>
    <td>numbers with decimal point like 100.00 or 30.2</td>
  </tr>
  <tr>
    <td>Strings</td>
    <td>str</td>
    <td>Ordered sequence of characters that uses double or single quotes like "hello" or 'hello'</td>
  </tr>
  <tr>
    <td>Lists</td>
    <td>list</td>
    <td>ordered sequence of objects; similar to JS arrays</td>
  </tr>
  
  <tr>
    <td>Dictionaries</td>
    <td>dict</td>
    <td>unordered key:value pairs</td>
  </tr>

  <tr>
    <td>Tuples</td>
    <td>tup</td>
    <td>ordered immutable sequence of objects</td>
  </tr>

  <tr>
    <td>Sets</td>
    <td>set</td>
    <td>unordered collection of unique objects</td>
  </tr>

  <tr>
    <td>Booleans</td>
    <td>bool</td>
    <td>logical value either True or False</td>
  </tr>
</table>

##Arithmetic Operations

<table style="width:100%">
  <tr>
    <th>Operation</th>
    <th>Symbol</th>
    <th>Meaning</th> 
    <th>Example</th>
  </tr>

  <tr>
    <td>Addition</td>
    <td> + </td>
    <td>To Add</td>
    <td> 2 + 2 </td>
  </tr>

  <tr>
    <td>Subtraction</td>
    <td> - </td>
    <td>To Subtract</td>
    <td> 2 - 2 </td>
  </tr>

  <tr>
    <td>Division</td>
    <td> / </td>
    <td>To Divide </td>
    <td> 2 / 2 </td>
  </tr>

  <tr>
    <td>Multiplication</td>
    <td> * </td>
    <td>To Multiply</td>
    <td> 2 * 2 </td>
  </tr>
  
  <tr>
    <td>Modulo Operator</td>
    <td> % </td>
    <td>To return the remainder after a division</td>
    <td> 5 % 5 = 0 </td>
  </tr>

</table>

## Variables, Done The Python Way

Python is dynamically typed like JavaScript, meaning you can reassign variables to different data types. Statically typed languages like C++ are more strict because you must define the type of value a variable is set to when you first initialize the variable and prevents the occurrence of bugs.

![link title](https://thepracticaldev.s3.amazonaws.com/i/l6dw14xglriy5949yo5f.png)

The <strong>type()</strong> function is a built-in method in Python that lets you check the data type of a variable in case you ever forget!

![link title](https://thepracticaldev.s3.amazonaws.com/i/inqadhsbd19a8b2padd9.png)

## Part I About Strings

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

### Index Notation

Indexing allows you to grab a single character from a string using index notation. Remember space within the string counts as characters!

![link title] (https://thepracticaldev.s3.amazonaws.com/i/f3psj2oy2wwth55mol4g.png)

The <strong>len</strong> function checks the length of a string. 

![link title](https://thepracticaldev.s3.amazonaws.com/i/nk0fambpjwmvfg1qtbk8.png)

### Escape Sequence

Definition: Special commands inside of your string.

#### Example:
To create a tab in your string use <strong> /n </strong>

![link title]
(https://thepracticaldev.s3.amazonaws.com/i/f9fphf3ym4un4aieb875.png)

### Reverse Indexing in a string

Allows you to grab the last used letter in a string

![link title](https://thepracticaldev.s3.amazonaws.com/i/ye5dn1gqvyvotyo8hhp2.png)

### Slicing

Grabs a subset or group of characters in a string

Remember <strong> start:stop:step </strong>!

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

# What Will I Learn Next in Day 2 of the #100DaysOfPython series?

<ul>
 <li>Lists and Tuples</li>
 <li>Sets and Dictionaries</li>
</ul>