Notizen
LECTURE 1
Inhalt der Notizen (2)
Seite 1
basic 1.0
VARIABLE ASSIGNMENT - WE DON'T HAVE TO DECLARE THE TYPE AS OTHER LANGUAGES, WE JUST CAN ASSIGN A VALUE DIRECTLY
e.g amount = 10 type(amount) = int
amount = amount + 4
amount = 5.55 type(amount) = float
PRINT STATEMENT- print(amount)
COMMENT = #THIS IS A COMMENT
IF-ELSE - if amount < 555:
print(amount)
String : s = "devesh is a good boy"
or s = 'devesh is a good boy'
print(s*4) = devesh is a good boy devesh is a good boy devesh is a good boy devesh is a good boy
THIS IS OPERATOR OVERLOADING!
Arithmetic Operations-
a + b Addition Sum of a and b
a - b Subtraction Difference of a and b
a * b Multiplication Product of a and b
a / b True division Quotient of a and b
a // b Floor division Quotient of a and b, removing fractional parts
a % b Modulus Integer remainder after division of a by b
a ** b Exponentiation a raised to the power of b
-a Negation The negative of a
RULE FOLLOWED BY PYTHON = PEDMAS
PARENTHESIS
EXPONENTIATION
DIVISION/MULTIPLICATION
ADDITION/SUBTRACTION
Some Built in Functions for numbers
print(max(1,2,3,4))
print(min(1,2,3,5))
print(abs(-32))
print(int('2323'))
Seite 2
Informationen
- Beschreibung
- BASICS OF PYTHON
- Erstellt von
- Devesh Pant · Aug 2019
- Aktualisiert
- 25 Aug 2019
- Aufrufe
- 21
- Tags
- Bewertung