0% found this document useful (0 votes)
3 views8 pages

Chapter 2 (Python)

The document provides an overview of Python modules, including built-in and external modules, and how to install them using pip. It covers variables, data types, and rules for defining variable names, as well as various operators in Python, such as arithmetic, assignment, comparison, and logical operators. Additionally, it explains the use of comments and the REPL (read-evaluate-print-loop) in Python programming.

Uploaded by

Vaibhav Roy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

Chapter 2 (Python)

The document provides an overview of Python modules, including built-in and external modules, and how to install them using pip. It covers variables, data types, and rules for defining variable names, as well as various operators in Python, such as arithmetic, assignment, comparison, and logical operators. Additionally, it explains the use of comments and the REPL (read-evaluate-print-loop) in Python programming.

Uploaded by

Vaibhav Roy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Make Notes from Youtube Videos

chapter 1
20:57

modules:- it is used if u have to run other code

two types of modules

I) built- in modules:- preinstalled in python

II) External modules:- need to install using pip

if u have to install any flask or os just put it

50:30
in the run section

"pip install flask

pip install os"

pip :- package manager for python u can use pip to install a module on your system (pip install flask
installs flask module)

24:56

REPL:- read- evaluate- print- loop

29:22
for comments

use ( # ) (pound single)

types of comments

1) single line comments - written using #

2) multi line comments - written using ('''comment''')

chapter 2
for string occupying more than 1 line than use triple quote(''') instead of double quote('')

Variables and data types


the variable is the name given to a memory location in a program. for example

a= "harry" --------- string

b= 345 ----------------- integer

c= 45.32 ----------------- float

variables = container to store a value

keywords = reserved words in python

identifiers = class/functions/ variable names

Data Types

primarily there are following data types in python

1) Integers -- 1,4,3,2 -2,-3 ,0 etc....

2) Floating- point numbers -- 1.2, 3.4 ,5.6 etc

3) strings --- no of characters enclosed in single (') double('') and triple quote (''')
3) strings --- no of characters enclosed in single (') double('') and triple quote (''')

4) booleans ------- true or false (sach or jhuth)

5) none ------- (much nahi ko return kare function)

don't use reserved keywords as a variables

like import, true, false etc......

50:30

52:25

booleans
#printing the variables

print(a)

print(b)

print(c)

print(d)

# printing the type of variables

print (type(a))

print(type(b))

print(type(c))

print(type(d))

56:23
57:31

Rules for defining a variable name-- > also applies to other identifiers

1) A variable name can contain alphabets, digits, and underscores.

2) A variable name can only start with an alphabet and underscore.

3) A variable name cant start with a digit.

4) no while space is allowed to be used inside a variable name.

identifiers -- class/ function/ variables name

Examples of a few variable names are:-

vaibhav, one8, seven, -seven etc,.

Operators in python

following are some common operators in python.

1) Arithmetic operators :- +,-,*,/ etc

2) Assignment operators :- =,+=,-= etc.

3) comparison operators :- ==, >, >= ,< ,!= etc

4) Logical operators :- and , or, not

01:06:16
Arithmetic operators

01:03:07

variable names are case sensitive

Assignment operators

a= 34

a += 12

print(a)

ans 46

or if a -= 12

print(a)

ans 22

a *=12
a /=12

print(a)

comparison operators

01:10:11

You might also like