GoConqr has a new look! Let us know what you think.

Notes

LECTURE 1

Devesh Pant pyhton digital English 2 pages

Content of the notes (2)

Page 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'))

Page 2

Information

Description
BASICS OF PYTHON
Created by
Devesh Pant
Views
21
Tags
kaggle
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?