Introduction to Python for Absolute Beginners
Key Takeaways
This video provides an introduction to Python programming for absolute beginners, covering variables, data types, operators, and basic syntax using tools like Python.
Full Transcript
all right great warm up your fingers in this lesson we will start coding what are the main concepts in programming is variables they are your best friends you will deal with them all the time you will use them to store information they will represent your data input let's say you want to have a variable X that is equal to the value of five and then ask the computer to tell you the value of that variable so we must tell the Machine that x equals five and this is how you could do this in Python type x equals five to go through the process of programming the line that says x equals five is called a command or a program this is just a line of text to make something out of it we must execute it only then will the computer carry out operations with it press Shift + Enter not just enter and a variable called X will be created and assigned with a value of five to be more precise equality in Python and in programming means a sign or bind to okay we carry this operation but we see nothing right now how can we ask the computer to show us the output of what we just did it would be sufficient to write X and then press Shift + Enter and here's the result 5 great as you can see typing in a single line of code and tells a few concepts of programming simultaneously now let's assign the value 8 to a variable we call Y all right shift + enter and we can check why however I'll type Capital y Oh an error this shows us that Python is case-sensitive so pay attention to that it matters if you use lowercase or uppercase letters an alternative way to execute the instruction that will provide the value we assigned to Y would be to use the print command at first sight it seems redundant as we showed we can just type Y nevertheless this command is applied often you'll see it in most of the code produced by professionals it complements the logical flow of your instructions for instance if we say print y the machine will simply execute this command and provide the value of y as a statement and this is all a programmer must see sometimes prynt exists in Python 3 as well its functionality is practically identical to the one just described for Python 2 with the sole difference that here you must place the name of the variable within parentheses in this case Y then you can press Shift + Enter to execute the code in the cell and see that you'll obtain an identical output the number 8 the difference stems from the fact that Python 3 treats print as a function while python 2 rather as a command therefore from now on if you are using Python 3 and you see print followed by a name of a variable please just add parentheses around the variable name and you'll be good to go great we hope you found this comparison useful now let's continue by talking about Python variables you can assign a certain number of values to the same number of variables to create the variables x and y we have to assign two values say 1 and 2 we must separate each of the variables in each of the values with a comma the parentheses here are not obligatory but we use them to improve the readability of our code now if I call X or Y separately the computer will correctly give me their respective values it is very important that the number of variables on that line equals the number of values otherwise you'll get an error message see great this is a great start to our journey in Python when programming not only in Python if you say that a variable has a numeric value you are being ambiguous the reason is that numbers can be integers or floating points also called floats for instance integers are positive or negative whole numbers without a decimal point let's create x1 and bind it to the value of 5 now x1 is an integer do you agree a specific function in Python can prove this is correct it is called type within the brackets we must place the name of the variable whose type of value we want to verify so in this case I'll type x1 ok Shift + Enter and the result we obtained is int which indicates the value is an integer the type function can also be applied directly to a value instead of a variable for instance if I write type open parentheses minus 6 close parentheses Python will correctly point out that minus 6 is an integer good now let's assign the value of 4.75 to a new variable x2 I would like to check its type hence I will use the type function again this is a float great floating points or as he'll more frequently here floats are real numbers hints they have a decimal point four point seven five is such a number therefore Python reads it as a float let's look at two other built-in functions int transforms the variable into an integer that's why 4.75 turns into four float instead we'll add a decimal point to the integer value and we'll turn it into a float not all variables should assume numeric values an example of such type of values is the boolean type in Python this means a true or false value corresponding to the machines logic of understanding ones and zeros on or off right or wrong true or false let's provide an example with a new variable X 3 which is equal to true right the output of the type function is bool which simply means X 3 is a boolean an important detail you should remember is you have to type true or false with capital letters otherwise Python won't recognize your variable as a boolean and will display an error message so to wrap it up the two boolean values a variable can have are true or false and they must be written with capital letters strings are text values composed of a sequence of characters let's see how we can create a string in practice if we ask the machine to display the name George this way we'll obtain an error message why because Python assumes George is the name of a variable to which we have assigned no value here's the magic trick that will correct this mistake let's type single quotation marks around the name George first and now let's type double quotation marks around it you see the output values of these two inputs are the same this is how Python displays text results if you don't use the Print command should you use print the output will be shown with no quotes you'll be able to see plain text if we assign this value to a new variable let's say x4 we can obtain its output as we did with the integers and floats all right so that's it if the values you'd like to assign are not numerical their quotes can come into play assume the variable Y is supposed to represent the number of dollars you have in your pocket in addition you would like to ask the machine to print out a statement that says Y dollars where Y is a number the proper way to combine the value of y and the string dollars is to use a plus sign as shown here let's execute this sale to check if we are missing something apparently we did not respect the rules of coding in Python we cannot put different types of variables in the same expression Y is an integer and dollars is a string we can convert Y into a string string STR is the built-in function we need in illogically two integers and floats string will convert our number into text and that will unlock our result to summarize what we said so far Python can automatically guess the type of data you are entering it is within its capabilities to know for sure whether you have assigned an integer a float a boolean or a string you need not declare the types of variables explicitly as you must do in some other programming languages Python always knows the type of variable what will happen if you type something like I'm fine you'll need the apostrophe in the English syntax not for the pythonic one observe if you execute the command like this you will make a mistake to avoid that in such situations you can distinguish between the two symbols put the text within double quotes and leave the apostrophe which technically coincides with the single quote between I and M now you are fine an alternative way to do that would be to leave the quotes on the sides and place a backslash before the apostrophe within the phrase and will still obtain the same correct result this backslash is called an escape character as it changes the interpretation of characters immediately after it and what if we wanted to State press enter where we put enter within inverted commas same logic the outer symbols must differ from the inner ones put single quotes on the sides and you obtained the desired result let's go through a few ways of stating values say you wish to print red car on the same line if I write it like this two words next to each other separated by a blank space I'll see them attached one trick would be to put a blank space before the second ' of the first word let's see nice that looks like the desired result another technique would be to sort of add one of the strings to the other by typing in a plus sign between the two just as we did with the tin dollar example a minute ago okay as your intuition probably tells you if you print this combination instead you'll obtain the same outcome but it won't have the quotes on the two sides and here's a new trick I'll type print read and then I'll put a comma which is called a trailing comma and Python will print the next word car on the same line separating the two words with a blank space Shift + Enter great let's print the number 3 next to the number 5 boom fantastic here it is what will happen if I don't use the print command and just list a few integers floats and strings separating them with commas Python will execute the command as expected but will place the values within parentheses strictly amazing great we are making excellent progress the next topic on our agenda are arithmetic operators the addition and subtraction signs are straightforward to use technically speaking in the equation you see here 1 & 2 are called operands while in the next one the operands are 3 & 5 the plus and minus signs are called operators and given they also represent arithmetic operations they can be called arithmetic operators division is more interesting if we want to divide 15 by 3 we will need to use the forward slash sign what will happen if we try to divide 16 by 3 five again yes the output was five because in Python 2 the quotient is an integer by default mathematically if we divide the integer 16 by 3 we'll obtain a quotient of 5 and a remainder of 1 if we use real numbers or floats the float 16 divided by 3 will result in a float value of 5 point 3 3 therefore we obtained as a quotient the integer 5 and no information regarding the remainder of the division of 16 by 3 this is one of the few substantial differences between Python 2 and 3 in Python 3 you would immediately get 5 point 3 3 as an answer or a float because the software will understand your first number what's a float value to avoid this when we use Python 2 we should look for the quotient of the float 16/3 and not of the integer 16 divided by 3 so we should either transform the number into a float or type it as a float directly see this is the correct answer now let's obtain the remainder of the division of 16 by 3 how can we make Python produce 1 as an output in this cell the operator that can help us is the percentage sign I'll type 16 percentage sign 3 and when I execute the command I will obtain the remainder the answer we received is 1 good multiplication as usual we can use the star sign when we want to multiply for example five star three will lead us to an output of 15 for the record you can assign any arithmetic operation to a variable if we assign 5 times 3 to the variable X and then we call X we will obtain 15 again great how could you calculate 5 to the power of 3 by using the double star operator type 5 2 stars 3 and here you go 125 easy right ok basically this covers arithmetic operators you know the right way to interpret the equal sign when programming is a sign or bind to for instance assign 5 to the power of 3 to the variable Y bind 5 to the power of 3/2 Y this means from that moment for the computer Y will be equal to 125 here's what will happen when you double the equality sign let me type Y double equality sign 125 the correct way to read this code is y equals 125 when you run this command the computer will assume you have requested an answer to the question is:why really equal to 125 this is why after the execution of this cell the machine will respond with a boolean value it will either return true or false let's check our output when we state y is equal to 126 great the Machine replied with false because 125 and 126 are different numbers wonderful remember when you mean equality between values and not assignment of values in Python you'll need the double equality sign any time you use it you'll obtain one of the two possible outcomes true or false okay let me explain a programming concept that is valid for other programming languages as well if I assign the value of 1 to a variable Z my output after executing Z will be 1 after that if I assign three to the same variable Z Z will be equal to three not one anymore how come well the order of the commands matters initially we said Z will be equal to one and that was true until we change the value to three for the computer from that moment on Z is not equal to one and it will continue to be three as proof see this if we add five to Z we will get eight not one plus five which is equal to six then if we suddenly decide Z is equal to seven Z will not be equal to one or three anymore Python reassigns values to its objects therefore remember the last command is valid and older commands are overwritten especially when your code becomes longer and by longer I mean containing tens or hundreds of rows it becomes difficult to understand how your work has been structured because there are too many lines what you could do in these situations is leave a comment comments are sentences not executed by the computer it doesn't read them as instructions the trick is to put a hash sign at the beginning of each line you would like to insert as a comment all improvised with a random sentence it is just a comment and non-code execute with Shift + Enter when you run the cell there will be no output because the comment does not count as code let's add code print 7 into on the same line execute with Shift + Enter yes precisely we got 7 + 2 in the comment row marked with the hashtag produced no output it remained visible only to the programmer the computer executed the print command only if we would like to leave a comment on two lines don't forget to place the hash sign at the beginning of each line these two will be comments you everything seems to work okay perfect I'd like to show you a neat trick that will be extremely valuable when you become an advanced Python programmer and work with large amounts of code this is a very handy feature so please pay attention sometimes the length of the sale will not suffice for you to finish your line lines of code could get long or just for the matter of organizing your code you might prefer to send part of the code to the next line so two point zero times one point five plus five could be written in two lines and the Machine could still read it as one command this could be achieved by putting a backslash where you would like the end of the first line to be it indicates you will continue the same command on a new line cool right all right great let's look at another important concept that will help us a great deal when working in Python indexing so here's an example of how indexing works the word Friday is written here right is it possible to extract the letter D yes we can do that by using square brackets and within them we should specify the position of the letter we would like to be extracted a very important thing you should remember is that in Python we count from zero not from one zero one two three four and so on that's why I'll ask for the fourth letter D by writing three here see and we obtained the letter D had we put four we would have obtained the letter A this is the syntax in this occasion square brackets right after the word or the string of characters if you wish and a number indicating the position of interest this is how indexing works in Python the next concept for programming in Python we will see here is fundamental it is called indentation the way you apply it in practice is important as this will be the only way to communicate your ideas to the Machine properly here is what I mean let's define a function five that takes as an argument and unknown X it will be a simple one X will be reassigned the value of five and the function will return the value of five for us please note that I am using an indent now we can print the result of five with an argument of three nothing happened why because printing 5 of 3 is within a function so it will be executed only when the function is applied if we place print on a new line instead align to the death command the output will be different how come the print command is executed on its own not as part of the 5 function deff and print form to separate and written in this way clearly distinguishable blocks of code or blocks of commands it makes sense to use indentation doesn't it everything that regards the function is written with one indentation to the inside once you decide to code something else start on a new line with no indentation the blocks of code are more visible and this clarifies the logic you are applying to solve your problem working with functions is interesting right we will learn more about the operators that will help us in our work in Python we will start with comparison operators we said if we type the Equality sign twice we can verify the left and right side of inequality are equal well if we use an exclamation mark and an equality sign then we could verify if two sides are not equal so it would be false to say 10 is not equal to 10 and it will be true that ten is not equal to fifteen if we use an exclamation mark and equal and the two sides we are comparing or ten and fifteen will obtain true as we wanted to verify they are not equal good what is next greater than and less than we can use the well-known symbols to test if a value is greater or smaller than another value is 100 greater than 50 yes it is is it smaller no it is not and that's why we get false that's great the logic behind checking whether an operand is greater than or equal to and less than or equal to is the same don't forget that on the right side of the operand we are not limited to providing only one number like tin we could insert an expression like tin plus 10 so is 15 greater than or equal to 10 plus 10 No is 15 less than or equal to 10 plus 5 well that is true great this covers everything we can possibly say about comparison operators now let's see what is intended with the expression logical operators also known as boolean operators briefly the logical operators in Python are the words not and and or they compare a certain amount of statements and return boolean values true or false hence their second name boolean operators let's start by providing an example with and and checks whether the two statements around it are true let's use only the boolean values true and false for now true and true will result in true while true-and-false gives an answer false false and false will naturally bring us to false okay or checks whether at least one of the two statements is true hints false or false we'll come back as a false whilst true or true will return true in this cell true or false we'll return true the order in which we have the two statements does not matter so false are true will still result in true as well the way not functions is it leads to the opposite of the given statement not true leads to false not false leads to true let's see a slightly different example the idea is to show you in this cell that the boolean operators can be applied not only to boolean values the statement 3 greater than 5 is false while 10 less than or equal to 20 is true false and true entails false and this is what we obtained good the fun starts when you combine these logical operators in these occasions you must respect the order of importance of these three operators it is not comes first then we have and and finally or the examples in these three cells will help you get the right intuition in the command true and not true we should first consider what the operator not will do it will be applied to the value true and not true means false therefore what's written in this cell must be interpreted as true and false now the remaining operator and can be applied true and false leads us to false the answer is correct false let's do an example with all three boolean operators false or not true and true false or not true and true logically is the same as false or false and true because before anything else not true must be read as false then and has an advantage over or this is why we will concentrate on the phrase false and true its outcome is false we are now left with false or false both values are false which always leads to false as expected false to solidify the concept let's go through another similar example true and not true or true is the same as true and false or true because initially not mattered most now and will convert true and false - false now we can think about the remaining false are true because the or operator needs at least one true statement to return true our result after running this cell will be true great let's see what identity operators are about the identity operators are the words is and is not they function similar to the double equality sign and the exclamation mark and equality sign we saw earlier let's illustrate their application with the following examples if we say 5 is 6 will immediately understand it is false the same as if we wrote it like this with the double equality sign if we said five is not six that be true and it will be the same as if we wrote five exclamation mark equals six great you have learned a lot about operators in Python and about its syntax thank you for watching if you found this video interesting and want to gain an edge in your career make sure to LIKE comment and subscribe and don't forget to check out some of our other videos for another quick win in the data science skills department
Original Description
👉🏻 Download Our Free Data Science Career Guide: https://bit.ly/2CvB6FU
In this tutorial we provide a much-needed introduction to programming for those of you who have not used Python or another coding language so far. In other words, this tutorial is created for absolute beginners.
Video Timestamps:
0:08 Variables
4:27 Numbers and Boolean
7:30 Strings
12:43 Arithmetic Operators
15:45 The Double Equality Sign
17:12 Reassign Values
18:17 Add Comments
19:42 Line Continuation
20:32 Indexing Elements
21:41 Structure Your Code with Indentation
23:21 Comparison Operators
25:22 Logical and Identity Operators
We will start the training from the ground up and will give you real-world practical examples so you can best understand each new skill you gain!
► Consider hitting the SUBSCRIBE button if you LIKE the content: https://www.youtube.com/c/365DataScience?sub_confirmation=1
► VISIT our website: https://bit.ly/365ds
🤝 Connect with us LinkedIn: https://www.linkedin.com/company/365datascience/
365 Data Science is an online educational career website that offers the incredible opportunity to find your way into the data science world no matter your previous knowledge and experience. We have prepared numerous courses that suit the needs of aspiring BI analysts, Data analysts and Data scientists.
We at 365 Data Science are committed educators who believe that curiosity should not be hindered by inability to access good learning resources. This is why we focus all our efforts on creating high-quality educational content which anyone can access online.
Check out our Data Science Career guides: https://www.youtube.com/playlist?list=PLaFfQroTgZnyQFq4nUfb-w2vEopN3ULMb
#Python #PythonTutorial #DataScience
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from 365 Data Science · 365 Data Science · 0 of 60
← Previous
Next →
1
2
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
Population vs Sample
365 Data Science
Data Science & Statistics: Levels of measurement
365 Data Science
Statistics Tutorials: Mean, median and mode
365 Data Science
Skewness
365 Data Science
What is a distribution?
365 Data Science
The Normal Distribution
365 Data Science
Central limit theorem
365 Data Science
Student's T Distribution
365 Data Science
Type I error vs Type II error
365 Data Science
Hypothesis testing. Null vs alternative
365 Data Science
The linear regression model
365 Data Science
Simple linear regression model. Geometrical representation
365 Data Science
INDEX and MATCH application of the two functions separately and combined [Advanced Excel]
365 Data Science
INDIRECT Excel Function: How it works and when to use it [Advanced Excel]
365 Data Science
VLOOKUP and MATCH another useful functions combination [Advanced Excel]
365 Data Science
VLOOKUP COLUMN and ROW - Handle large data tables with ease [Advanced Excel]
365 Data Science
The ELIF keyword [Python Fundamentals]
365 Data Science
Working with Tuples in Python
365 Data Science
Database Terminology - A Beginners Guide
365 Data Science
Relational Database Essentials
365 Data Science
Database vs Spreadsheet - Advantages and Disadvantages
365 Data Science
Conditional Statements and Loops
365 Data Science
Backpropagation – The Math Behind Optimization
365 Data Science
Monte Carlo: Forecasting Stock Prices Part I
365 Data Science
Monte Carlo: Forecasting Stock Prices Part II
365 Data Science
Monte Carlo: Forecasting Stock Prices Part III
365 Data Science
365 Data Science Online Program
365 Data Science
Data frames - Creating a data frame
365 Data Science
Data Science & Statistics: Slicing a matrix in R
365 Data Science
Data frames in R - Exporting data in R
365 Data Science
Data frames in R - Transforming data PART II
365 Data Science
Data Frames in R - Subsetting a data frame
365 Data Science
Data Science & Statistics: Matrix arithmetic in R
365 Data Science
Data Science & Statistics: Indexing an element from a matrix
365 Data Science
Data Frames in R - Extending a data frame
365 Data Science
Data Science & Statistics: Creating a matrix in R FASTER
365 Data Science
Data Science & Statistics: Creating a Matrix in R
365 Data Science
Data frames - Importing data in R
365 Data Science
Data frames in R - Getting a sense of your data
365 Data Science
Data frames in R - Transforming data PART I
365 Data Science
Data frames in R - Import a CSV in R
365 Data Science
Data Science & Statistics: Matrix operations in R
365 Data Science
Data Science & Statistics: Matrix recycling in R
365 Data Science
Tableau vs Excel: When to use Tableau and when to use Excel
365 Data Science
Download Tableau: Learn how to download Tableau Public
365 Data Science
Connecting data sources: Useful tips when connecting data sources to Tableau
365 Data Science
The Tableau interface: See how to navigate through the Tableau interface
365 Data Science
Tableau data visualization: Create your first Tableau visualization!
365 Data Science
Duplicating sheets: This is how to duplicate a sheet in Tableau
365 Data Science
Build a table in Tableau: The steps needed to create a simple table in Tableau
365 Data Science
Custom fields in Tableau: Using Tableau operators to create custom fields
365 Data Science
Custom fields in Tableau: Add calculations to tables through custom fields
365 Data Science
Totals in Tableau: Learn how to display subtotals and totals in Tableau
365 Data Science
Gross Margin calculation in Tableau
365 Data Science
What is a filter in Tableau: Set up a filter in Tableau to specify the data you want to show
365 Data Science
Joins in Tableau: Inner, outer, left, or a right join in Tableau
365 Data Science
Building a Tableau dashboard: Three types of charts you want to have in a Tableau dashboard
365 Data Science
Creating great looking charts in Tableau: Real life Exercise on charts in Tableau
365 Data Science
Joins in Tableau: Choose the correct join type
365 Data Science
How to make a data check in Tableau: A quick data check is better than no data check
365 Data Science
More on: LLM Foundations
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
How to prepare TIC teacher exams in Spain with AI (oposiciones 2026)
Dev.to AI
Why I built a simple AI provider wrapper (and you might too)
Dev.to · zhongqiyue
This ChatGPT Prompt Replaced 3 Hours of PowerPoint Work
Medium · AI
This ChatGPT Prompt Replaced 3 Hours of PowerPoint Work
Medium · ChatGPT
Chapters (12)
0:08
Variables
4:27
Numbers and Boolean
7:30
Strings
12:43
Arithmetic Operators
15:45
The Double Equality Sign
17:12
Reassign Values
18:17
Add Comments
19:42
Line Continuation
20:32
Indexing Elements
21:41
Structure Your Code with Indentation
23:21
Comparison Operators
25:22
Logical and Identity Operators
🎓
Tutor Explanation
DeepCamp AI