Python Tutorial - 2. Variables
Skills:
Python for Data90%
Key Takeaways
Creating and using variables in Python to store data
Full Transcript
hello today's topic is variables in Python now what are variables variables are containers that can hold any data so you can use them to store numeric data tax data Etc so let's say you want to track down your monthly expenses in Python programming language what you need to do first to solve this problem is store individual expenses in some place and then use that place to do a sum of all those individ individual expenses to come up with your total expense so we'll go ahead and create variable to store all these individual expenses so for example let's on rent you are spending $220 so what we just did here is we created this varable called rant and we placed value 1220 into it so using assignment operator you can put a value inside a variable so the left on the left hand side of the assignment operator is a variable name and right hand side is the value similarly you can create variables for other items for example you're spending $22 and5 on gas and you're spending some money on groceries so we just created three variables now if you print their value you can print it like this so by using this statement you what you're doing is you are accessing this variable called rant and you are printing the value in it okay now to calculate the total monthly expenses all you do is just add those three things and this is the syntax on how to do it in Python so you created a fourth variable called total and you added all these three individual values in it so if you print total you will get this okay now variables are called VAR Ables because the value in it can vary so for example now let's say instead your rent went up and it become $1,400 so you can use the same variable and assign a different value so again the container is same is just that you now remove the previous value and you put the new value in it okay uh you can also uh put tax data into it so for example uh now I want to store the name of those individual grou U expense items so you can create a variable called item and put the name item my item two was gas and my item three was groceries so this way now you can just print all those items so you can say my expense items were these so you see like when you do this it is printing the value inside these three variables now there are certain rules on variable naming conventions so for example you cannot use certain python keywords like the the predefined keywords as variable name for example true is a keyword in Python what I mean by that that is it has a specific meaning in Python so you cannot use it as a variable name so if you try to do that you'll get this error to get a complete list of python keywords you can just Google it and you'll get a list so don't use that list as variable names other than that you cannot use faal characters in it for example if I create a variable like this then also it won't work because I have a plus sign here okay so that was all about variable thanks for watching
Original Description
In this Python tutorial, we will learn about variables. The video will cover how to create variables, assign values to variables and certain rules on a variable naming convention.
Topics that are covered in this Python Video:
0:00 Introduction
0:45 Create variables to store numbers
2:54 Create variables to store text data
3:40 Rules of variable naming convention
Do you want to learn technology from me? Check https://codebasics.io/ for my affordable video courses.
Video without background music: https://youtu.be/8tCe1P_cgoY
Visit http://codebasicshub.com/tutorial/python/variables to download answers on exercises.
Next Video:
Python Tutorial - 3. Numbers: https://www.youtube.com/watch?v=YJKEqaaSGDs&list=PLeo1K3hjS3usILfyvQlvUBokXkHPSve6S&index=4
Website: https://codebasics.io/
Facebook: https://www.facebook.com/codebasicshub
Twitter: https://twitter.com/codebasicshub
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from codebasics · codebasics · 2 of 60
1
▶
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Python Tutorial - 1. Install python on windows
codebasics
Python Tutorial - 2. Variables
codebasics
Python Tutorial - 3. Numbers
codebasics
Python Tutorial - 4. Strings
codebasics
Python Tutorial - 5. Lists
codebasics
Python Tutorial - 6. Install PyCharm on Windows
codebasics
PyCharm Tutorial - 7. Debug python code using PyCharm
codebasics
Python Tutorial - 8. If Statement
codebasics
Python Tutorial - 9. For loop
codebasics
Python Tutorial - 10. Functions
codebasics
Python Tutorial - 11. Dictionaries and Tuples
codebasics
Python Tutorial - 12. Modules
codebasics
Python Tutorial - 13. Reading/Writing Files
codebasics
How to install Julia on Windows
codebasics
Python Tutorial - 14. Working With JSON
codebasics
Julia Tutorial - 1. Variables
codebasics
Julia Tutorial - 2. Numbers
codebasics
Python Tutorial - 15. if __name__ == "__main__"
codebasics
Julia Tutorial - Why Should I Learn Julia Programming Language
codebasics
Python Tutorial - 16. Exception Handling
codebasics
Julia Tutorial - 3. Complex and Rational Numbers
codebasics
Julia Tutorial - 4. Strings
codebasics
Python Tutorial - 17. Class and Objects
codebasics
Julia Tutorial - 5. Functions
codebasics
Julia Tutorial - 6. If Statement and Ternary Operator
codebasics
Julia Tutorial - 7. For While Loop
codebasics
Python Tutorial - 18. Inheritance
codebasics
Julia Tutorial - 8. begin and (;) Compound Expressions
codebasics
Python Tutorial - 12.1 - Install Python Module (using pip)
codebasics
Julia Tutorial - 9. Tasks (a.k.a. Generators or Coroutines)
codebasics
Julia Tutorial - 10. Exception Handling
codebasics
Python Tutorial - 19. Multiple Inheritance
codebasics
Python Tutorial - 20. Raise Exception And Finally
codebasics
Python Tutorial - 21. Iterators
codebasics
Python Tutorial - 22. Generators
codebasics
Python Tutorial - 23. List Set Dict Comprehensions
codebasics
Python Tutorial - 24. Sets and Frozen Sets
codebasics
Python Tutorial - 25. Command line argument processing using argparse
codebasics
Debugging Tips - What is bug and debugging?
codebasics
Debugging Tips - Conditional Breakpoint
codebasics
Debugging Tips - Watches and Call Stack
codebasics
Python Tutorial - 26. Multithreading - Introduction
codebasics
Git Tutorial 3: How To Install Git
codebasics
Git Tutorial 1: What is git / What is version control system?
codebasics
Git Tutorial 2 : What is Github? | github tutorial
codebasics
Git Tutorial 4: Basic Commands: add, commit, push
codebasics
Git Tutorial 5: Undoing/Reverting/Resetting code changes
codebasics
Git Tutorial 6: Branches (Create, Merge, Delete a branch)
codebasics
Git Github Tutorial 10: What is Pull Request?
codebasics
Git Tutorial 7: What is HEAD?
codebasics
Git Tutorial 9: Diff and Merge using meld
codebasics
Difference between Multiprocessing and Multithreading
codebasics
Python Tutorial - 27. Multiprocessing Introduction
codebasics
Python Tutorial - 28. Sharing Data Between Processes Using Array and Value
codebasics
Git Tutorial 8 - .gitignore file
codebasics
Python Tutorial - 29. Sharing Data Between Processes Using Multiprocessing Queue
codebasics
Python Tutorial - 30. Multiprocessing Lock
codebasics
Python Tutorial - 31. Multiprocessing Pool (Map Reduce)
codebasics
What is code?
codebasics
Python unit testing - pytest introduction
codebasics
More on: Python for Data
View skill →Related AI Lessons
Chapters (4)
Introduction
0:45
Create variables to store numbers
2:54
Create variables to store text data
3:40
Rules of variable naming convention
🎓
Tutor Explanation
DeepCamp AI