Learn Python Episode #13: Variables

in dtube •  7 years ago 


Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://goo.gl/XW4Q1i

In this video we are going to cover variables in Python, and as you may have guessed, a variable is an object that is variable in nature. So, why do we use variables in our code? Well, when we explicitly write strings they are not reusable. If I were to simply write "This is a sting," I would be unable to reuse that line of code later on in my script. So, one reason we use variables is for re-usability. Another reason we use variables is for passing values into functions, but we will get into that in a later video. The nice thing about Python is that we don't need to declare or define the type of variable. Creating a variable is as simple as this:

greeting = "hello world"

When you hit enter in your terminal or command prompt, Python will not output a response. However, when we call our new variable, Python will print out "hello world"

print(greeting)

Now that the greeting variable is stored in memory, we can make changes to it.

greeting = greeting.split (" ")[0]

If we print(greeting) now it will returns hello. We can write the following to return hello nick:

print(greeting + " Nick")

In the next video we're going to be talking about some of the built-in functions available to you in Python.

Web - https://josephdelgadillo.com/
Subscribe - https://goo.gl/tkaGgy
Follow for Updates - https://goo.gl/DPZvua


► Watch on DTube
► Watch Source (IPFS)

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thanks for sharing...

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://www.udemy.com/python-complete/

Where are the other 12 parts?

Hey! Check out this playlist for the entire tutorial series:
https://www.youtube.com/playlist?list=PLYmlEoSHldN46dpxzEgcG83VxcEr_L9zq