loading...

#100DaysOfPython Day 1: Hello World, Data Types & Strings

taeluralexis profile image Tae'lur Alexis ๐Ÿฆ„โš› Originally published at taeluralexis.com ใƒปUpdated on ใƒป4 min read

link title

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

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.

The Journey to Hello World

link title

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.

Data Types

ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย 
NameData TypeMeaning
integersintwhole numbers like 1, 2, 3
Floating point float numbers with decimal point like 100.00 or 30.2
Strings str Ordered sequence of characters that uses double or single quotes like "hello" or 'hello'
Lists list ordered sequence of objects; similar to JS arrays
Dictionaries dict unordered key:value pairs
Tuples tup ordered immutable sequence of objects
Sets set unordered collection of unique objects
Booleans bool logical value either True or False

Arithmetic Operations

ย  ย  ย  ย  ย  ย 
OperationSymbol MeaningExample
Addition + To Add 2 + 2
Subtraction - To Subtract 2 - 2
Division / To Divide 2 / 2
Multiplication * To Multiply 2 * 2
Modulo Operator % To return the remainder after a division 5 % 5 = 0

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

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!

link title

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

The len function checks the length of a string.

link title

Escape Sequence

Definition: Special commands inside of your string.

Example:

To create a tab in your string use /n

link title

Reverse Indexing in a string

Allows you to grab the last used letter in a string

link title

Slicing

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

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

  • Lists and Tuples
  • Sets and Dictionaries

Discussion

pic
Editor guide
Collapse
sararf22 profile image
SaraRF22

I'm currently learning paython, and I learned all about fundamentals , but I'm still struggling how to write functions with multiple parameters , setting the write decisions!, with this I decided to go back and focusing on basics , algorithms.

Collapse
digdugprophetie profile image
ุงุฏุฑูŠุณ ู…

Nice start. Will follow and see the similarities/differences between my experiences coming into Python from an old-school Unix admin background, and yours as a frontend dev. All the best!

Collapse
taeluralexis profile image
Tae'lur Alexis ๐Ÿฆ„โš› Author

Thank you! I hope you enjoy ๐Ÿ™๐Ÿฝ

Collapse
jnario profile image
Jose Nario

Welcome to Python.. Good luck on the 100 days!

Collapse
eli profile image
Eli Bierman

Great post! I love this notes format.

Collapse
taeluralexis profile image
Collapse
sirish_bhatta profile image
Sirish Bhatta

Thanks. Completed day 1 and 2 so far. Coming from SQL world (Oracle, sql server, ssis, Ssrs Tableau), so far I am following along. Thanks for putting this together!

Collapse
taeluralexis profile image
Tae'lur Alexis ๐Ÿฆ„โš› Author

Congrats! Keep going ๐Ÿ’™๐Ÿ‘๐Ÿฝ

Collapse
cesarau0619 profile image
Cesar Augusto

Nices pots

Collapse
kodondi profile image
kodondi

Good start up

Collapse
rjsuresh profile image
Suresh

It was really interesting and looking forward to the next post so I can complete it quickly. Thank you for taking time to write this for the community.

Collapse
joellau profile image
Joel Lau

Great post! Love the format and how succinct it is. Noticed you made a small typo though

typo

Collapse
awwsmm profile image
Andrew (he/him)

Hi Tae'lur! I follow you on Twitter! Good to see you here on DEV. I'm looking forward to following your 100 Days of Python! It sounds like quite the challenge!

Collapse
taeluralexis profile image
Collapse
k4nga profile image
K4NGA

Cool, my main language is Python atm. Would you recommend me trying 100 days of JS?

Collapse
taeluralexis profile image
Tae'lur Alexis ๐Ÿฆ„โš› Author

It doesn't hurt to try! Always try to remember that it's not a failure if you can't find time every single day to study though

Collapse
nkamwa_marcel profile image
Nkamwa marcel

Great write-up!
I just started my journey to programming with python and your idea of #100DaysOfPython really fascinates me. Tomorrow, I am going to kick-start the challenge.

Collapse
schwitzd profile image
Schwitzd

Day 2? ๐Ÿ˜

Collapse
taeluralexis profile image
Tae'lur Alexis ๐Ÿฆ„โš› Author

In the post, it states that I write posts every day but that the articles will be released over time:)

Collapse
westcliffe profile image
westcliffe

I am beginner on python and will keep following your path. Thanks for hard working and sharing heart.

Collapse
umamaheswaruk profile image
umamaheswaruk

Great Post Tae'lur Alexis, it helps beginners like me. I am going to follow these posts.

Thanks
Uma

Collapse
ba7774real12 profile image
Ba Balde

Hi, my name is Balde. I am doing my degree course in cyber and network design. I have python as one of my studies module. Would you give me some advice or tips please. Thank

Collapse
krishnaghatti profile image
Sri Krishna

This is a nice start and also a way to refresh topics for me. @taeluralexis are you planning to publish a post every day for this? (I am not seeing the continuation to this on dev.to)

Collapse
taeluralexis profile image
Tae'lur Alexis ๐Ÿฆ„โš› Author

They won't be published every single day. I'm just converting the notes into blog posts and they'll be scheduled out over time.

Collapse
gadroic profile image
Gรฃdrรธรฎรง

nice.

String = 'Hello'
Index= 0,1,2,3,4
String[0]='H'

Goodluck!

Collapse
Sloan, the sloth mascot
Comment deleted