LECTURE 1

Beschreibung

BASICS OF PYTHON
Devesh Pant
Notiz von Devesh Pant, aktualisiert more than 1 year ago
Devesh Pant
Erstellt von Devesh Pant vor mehr als 5 Jahre
3
0

Zusammenfassung der Ressource

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

Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Neuroanatomy Lecture I
Matthew Coulson
Highway Engineering 1 lecture 1
Pauline Leota
Introduction to Microbiology
nfnabilah_14
Psyc3082 - Lecture 1
renaecollett
Outbrain Click Prediction
Hai Truong
MICR 223 lecture 1
Paige Waddington
Lecture 1 - Intro
samflint93
Medical Microbiology L1
Idont Evencare
PSYC4121 Lecture 1
Deanna Varley
Plant Pathology
nfnabilah_14
Fundamental of Cell Biology
nfnabilah_14