![]() |
Erstellt von Devesh Pant
vor etwa 5 Jahre
|
|
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!
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
print(max(1,2,3,4)) print(min(1,2,3,5)) print(abs(-32)) print(int('2323'))
Möchten Sie kostenlos Ihre eigenen Notizen mit GoConqr erstellen? Mehr erfahren.