Learn with Baivaru - Python 1
I've been meaning to start a basic programming tutorial series for a few weeks now. The past few weeks have been a bit busy. Lots of classes, work on some Baivaru (Media,Images), automating several tasks and implementing some new ideas.
To keep this as short but as detailed as possible, I'll be explaining only a few things per post. Let's dive right into Day 1.
Note: disable_humor.exe is running
Prerequisites:
1. Python - Install the latest version of Python here
2. Text Editor - You can use any text editor or IDLE that comes with Python, but I recommend Visual Studio Code with the Python extension for linting, debugging, code formatting and more.
3. Some basic programming knowledge - I am going to assume you know basic terminology and skip most of the theory.
Variables
Let's start with variables in Python. You can use any alphabetical letter or special characters or any number to name a variable. However you can't use certain characters such as '+', '-' and any other that has special meanings in Python. Also, you can't start a variable using a number. Always, keep in mind that variables are case sensitive. Hence, I normally opt to use lowercase variables. It is ideal to use short and meaningful words.
Note: PEP8, Style Guide for Python Code, recommends using snake_case.
Example: input_one
The following words are reserved keywords and should not be used to name variables.
Unlike many other programming languages, you don't have to specify variable type before assigning values.
You can assign values to variables using '=' sign. You can assign the same value to multiple variables as well.
Example:
a = 123
b = c = d = 'Hey'
The value of a is 123 while the value of b, c or d would be Hey
Below are different variable type available in Python
Integer: a = 99
Float: a = 99.99
String: a = 'Baivaru'
List: a = [1,9,9]
Tuple: a = (1,3,6)
File: a = open(baivaru.txt, 'r')
That's it for the first post in this tutorial series. If you have any questions feel free to join @BaivaruRequests and ask for help.
Baivaru People, Baivaru Minds, Baivaru Things.