PY
py
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
print(" BASIC CONCEPTS ")
print("""_______________________________________________
I am only a beginner, and this is a summary of what I've learned so far in when it comes to Basic Concepts of Python""")
print("_______________________________________________")
print(" Printing Texts ")
print(" ----------------------------------------------- ")
print("- First of all in Python, we use the function \"print\" to output text(s)")
print(" Simple Operation ")
print("-----------------------------------------------")
print("- Python can carry out simple operations, and much more such as adding, subtracting, dividing, and multiplying, exponents, finding quotients and remainders too!")
print("------")
print("~ For example: " + "3 + 4 = 7 ; " + "4 - 3 = 1 ; " + "4 / 4 = 1.0 ; " + "-4 + -4 = -8 ; " + "3 * 4 = 20 ; " + "3 ** 2 = 9")
print("------")
print("IMPORTANT - When you are dividing numbers using a FORWARD slash (not backlash), you produce a float, which is a number with a demical, including .0, also, you cannot divide integers (whole numbers) with zeroes!")
print(" ------------------------")
print("* QUOTIENTS AND REMAINDERS")
print(" ------------------------")
print("NOTE - I made this a \"sub topic\" of \"Simple Operation\" because it's a little more complicated")
print("- When we are trying to find a quotient and remainder of a number, we use the FLOOR DIVISION and MODULO operators. Floor division is done using \"//\" to find the quotient of a number, meaning \"how many of this number can fit into that number, like 6 would fit into 18 three times.\" Modulo operators, on the other hand, is done by using \"%,\" a percent sign, to find the remainder.")
print("------")
print("~ For example: " + "20 // 6 = 3 ; " + "20 % 6 = 2")
print("------")
print("-----------------------------------------------")
print(" Floats")
print("-----------------------------------------------")
print("- Floats are basically non-integers that contains a decimal point (like 7.15), this also includings a .0 decimal point (like 7.0). It can be created by directly entering a float into Python, operating between a float and an integer, and namely division will give you a float, even if you divide it with integers and it results in a whole number, there will be a .0 decimal point. Also, unnecessary zeroes at the end of the floars are ignored. Floats can also be added to integers, since Python converts the integer to float \"silently\"")
print("------")
print("~ For example: 3 / 4 = 0.75 ; 5.10000 = 5.1 ; 4 + 7.0 = 11.0 ; 7 / 7 = 1.0")
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run