Hello readers and learners, welcome to python tutorial for complete beginners! Why another python tutorial? To encourage beginners to learn coding in a faster and smarter way, even they didn’t write a single line of code in their life. You can ask any doubts and questions in the comment section below. Let’s get started!
What the heck is programming?
If you know about programming, you can skip this. A programming language is a set of instructions that we give to the computer to do the operations we need. As a human, we can’t solve more complex calculations, and we don’t have more memory to store everything. That’s where computers gave an entry. All the computer applications made up of computer programming inside it. For example, calculator applications do complex mathematical computations within a second, entirely because of programming behind the screen we see. At the end of this tutorial series, I’m sure you’re going to build a python application on your own!
If you haven’t subscribed to our blog, please press the bell icon in the bottom left and get notified!
I don’t want to give an intro on Python or programming language, let’s jump directly into the main topic as I said earlier, “learn smarter and faster”.
Python Environment Setup?
We don’t need any setup for Python in your machine for now. For a beginner, I’d suggest Online Compilers just like repl.it. Just create an account in repl and create Python repl and run your python code! Simple, Isn’t it?
What is meant by variable?
A variable is a name that we give to a value which we store in the memory locations. The value can be identified with its variable name and can change anytime during the execution of the program. (For example, consider you’re a human with millions of cells, but you’ll be identified by your name only. Right? ). Let’s see with an example.
(Note: print means just showing/printing the elements in the console. It prints whatever we give inside the bracket)
Let’s see another example!
a = 100 print(a) # Output: 100 name = "Narendran" print(name) #Just prints the value inside name # Output: Narendran
(Whatever we give inside the quotes (” “) is a string. A string is used to represent letters rather than the numbers)
You may doubt that why do we need a variable? “I can print whatever stuffs I want. Then, why variable?”
See, if you want to remember “I’m a long, long, long, long, long sentence.” Can you remember this wherever you want to print? Absolutely, not.
Hence, assign a variable like sentence = “I’m a long, long, long, long, long sentence.” Just use print(sentence) wherever you want to print that sentence in your program!
I hope you’ve got a clear idea of variables! Let’s do some calculations with the variables.
Problem: Given two variables a and b, add a and b and store it in a variable add, and subtract a from b store in a variable diff, and print the multiplication of add and diff.
a = 10 b = 20 add = a + b diff = b - a print(add*diff)
From the above example, you might have seen that I used some strange things like ‘+’, ‘*’, ‘-‘ (strange if you’re a complete beginner).
Those are called operators. An operator is a symbol that tells the computer to do the specific mathematical or logical operation and gives the result. I drop some basic python operators, and we can dive deeper into this topic afterward.
|%||Modulus (a%b) => Returns remainder of the division|
|**||Power/Exponentiation (a**b) => a power b|
(Tip for beginners: In variable definition, right side value will be assigned to the left side value always.)
It’s your try, try using all the operators I gave above in a program! And you can drop in the comment section anytime!
What next? Functions in Python.
Subscribe to the notifications to receive notifications on my next tutorial!
Next, Functions and Indent- Click Here
Also, see: Learn To Code