This article will cover almost everything you need to get started with Python. Python has become one of the most popular programming languages and is used every day by programmers to do cool things like automate, build applications and websites like Instagram, and it is used in Artificial Intelligence (AI).
No one is too old or too young to learn Python. Python is very easy to learn.
Download Python from this link -> https://www.python.org/downloads/.
Install after downloading the latest Python from the above link.
Don’t forget to click on check Add Python 3.x to PATH.
IDE stands for Integrated Development Environment. It enables programmers to combine different aspects of writing code. IDEs increase programmer’s productivity by simplifying common activities in a single application like editing source code, debugging and building executables. There are different IDEs available like PyCharm, VS Code, Sublime text, and IDLE (default).
The intelligent code editor provided by PyCharm enables programmers to write a high quality Python code.
The editor enables programmers to read code easily through color schemes, and auto indents on new lines automatically.
3.The smart code navigation option provided by PyCharm helps programmers to edit and improve the code quality without putting in extra time. It makes both local and global changes very quickly and efficiently.
PyCharm comes with a local terminal which enables the programmers to continue coding and testing without leaving the IDE.
Download PyCharm from this link.
Install Pycharm.
Click on the new Project.
Make sure in Project Interpreter, the base interpreter is set to your installed python version.
Writing First Python Program
Right-click on the new project created.
New -> Python File
Give <Filename>.py
Type print(‘This is my first python program’)
Click on run
Python executes the program line by line.
For reference,users can read documentation at: Read Docs and can also read sample codes here: Samples
Variables are used in programming languages to temporarily store data in a computer’s memory.
For example:
When Python interpreter executes this code, it will allocate some memory and thenstore the number 29 in the memory and attach 29 to the label age.
Integer, float, string, and Boolean are the data types in Python.
A string is a sequence of characters. To make a string, we may enclose a sequence of characters between single, double, or triple quotes.
Thus, ‘Hello world’, ’ "Hello " ‘, "what’s ", ‘’‘today’s “action” plan?’’’ are the examples of strings.
1 2 3 4 5 6
print('Hello world') print("What’s ") print('' 'today' s plan ? '' ' )
These operators are used to compare two expressions and returns either true or false. These are greater than (>), less than (<), equals to (==), greater than equal to (>=), less than equal to (<=), not equal to (! =), they can be used for any data types.
The logical operators not, and, and or are applied to logical operands true and false, also called Boolean values, and yield either true or false. Not is an unary operator it requires only one operand.
*and operator – It returns true only when both the expressions are true else false.
or operator – It returns true if any one of the expressions is true else false.
not operator – It returns the opposite of the expression.
Bitwise operators are the operators that operate on integers interpreted as strings of binary digits 0 and 1, also called bits.
Bitwise and (&)
Bitwise or (|)
Bitwise complement (~)
Bitwise Exclusive to (^)
Left Shift (<<)
Right Shift (>>)
Built-in functions are the predefined functions that are already available in Python.
The function input enables us to accept an input string from the user without evaluating its value. The function input continues to read input text from the user until it encounters a new line, for example:
This function is used to evaluate the value of the string.
print() function enables us to produce output in Python. Print function can also have an escape sequence which can print different types of data at a time separating the values with a comma.
type() Function: It returns the data type of the parameter.
max(), min() Function: It returns the maximum and minimum value of the data given.
round() Function: It rounds the value of the parameter and returns the rounded value.
pow() Function: It takes two values, number and exponent, and returns number to the power of exponent.
HERE IS A LIST OF OTHER BUILT-IN FUNCTIONS
Try it yourself:
Create a variable name which will take the input from the user and print it.
Print the maximum and minimum values out of four values.
Input five values and print their respective data types.
Input two numbers x and y and print x raised to power y.