Python: a programming language used for general uses, data science, software prototypes, etc.
IDLE: integrated development learning environment for beginners this will be the main way of accessing Python. It automatically comes with your installation of Python.
Recommend for you about IDLE: You can choose any IDLEs you want, but you can consider Visual Studio Code, PyCharm community, ...
Install Python: Go to page https://www.python.org/downloads/ and follow the guide.
Python like most high-level programming languages (Java, ruby, JavaScript, C++, C#) can work as a calculator. Type some of these in your python shell to see some of the outputs.
x + y # Sum of x and y
x - y # Difference of x and y
x * y # Product of x and y
x / y # Quotient of x and y
x // y # Rounded down quotient of x and y
x % y # Remainder of x and y
x ** y # x to the y power
We can use # for comment one line, use ''' or """ (triple quotation) to comment one or multi line.
Example:
# This is a one-line comment. Do nothing.
"""
Here are comments for multi-line.
First is A
Second is B
Third is C
"""
Variables are placeholders of information in the memory. It’s used in sort of the same way as in algebra
>>> A = 12
>>> 10 + A = 22
In programming a variable is used to access and manipulate data. A variable is a name that represents a piece of information in the computer’s memory. In Python, you create and set variables. In Python to create a variable you use the = sign.
>>> Height = 20
To use the variable you can substitute it into any of the calculations from earlier.
>>> 12 + height = 32
Variable Naming rules:
You can’t use one of python’s key words as a variable name
You can’t have spaces in your variable name
The first character of a variable must be a letter or an underscore
Python is case sensitive X is different than x
When creating variables it’s good practice to name the variable so it reflects the purpose of the variable. Programmers also tend to use camel case or underscores to denote different words so a variable called grosspay would look like gross_pay or grossPay .:
Variables can hold a lot more than just numbers. In programming variables can hold a multitude of information including (strings, numbers, data frames, Booleans, floats, lists)
# Create a variable and display it
first_name = “James” # To denote words to a variable you will have to use quotation marks
last_name = “Smith”
# display the values
print(first_Name, last_Name)