Notes-chapter1-python-class 9
Notes-chapter1-python-class 9
Class 9
Computer-Chapter 1
1. Comments in python
python.
• Multiline comment
2. Python datatypes
1) Numeric
2) Boolean
3) Set
4) Mapping
5) Sequence
3. Numeric
1) Int-Whole numbers
2) Float-(floating point real values)
3) Complex-(mixed values of characters and numbers)
4. List
A list contains items separated by commas and enclosed within square brackets([
5. tuple
A tuple contains items separated by commas and enclosed within brackets(). Tuples are
Eg:tuple1=(1,2,3,4,5)
• If
• If else
• Nested if
Syntax:
IF CONDITION
If condition:
Statement……
IF ELSE CONDITION
If condition:
Statement…
Else:
Statement…
NESTED IF CONDITION
1):
If(condition 2):
Statement..
ELIF STATEMENT
Eg: If expression 1:
statement(s)
Elif expression
Statement(s)
Elif expression 3:
Statement(s)Elif expression
Statement(s)
LOOPS
A loop is a piece of code which allows you to repeat a code more than once .without writing it more than once
• While loops
• For loop
For loop
For loop is used when you know how many times you have to repeat a taskEg:
While loop
While loop is used when we have to execute a code until a condition is true Example in
Continue statement
Eg:
Pass Statement
When the pass statement is executed, nothing happens, but you avoid getting an error when empty code is not
allowed.
Empty code is not allowed in loops, function definitions, class definitions, or in if statements.
Eg:
Functions
A function is an organized and reusable code used to perform specific task.
Example:def Functionname():
• Calling a function
For using a function we have to call the function inside the program using function name.
Example:functionname();
Return statement
Example:Return [expression]
Types of variables
• Global variable
• Local variables
Global variable:-The variable which is created outside the function is called as global variable
Local variables:-The variables which created inside the function is called as local variable.
Chapter 2
MySQL
Database
A collection of data in an organized way for future reference is called as database.And database used in applications
like, Instagram, facebook, google ,amazon,etc.
DBMS
Full form is database management system. also called as Relational database Management system(RDBMS) .
It is a middleware between user and database.
ER -Model
Full form of ER model is Entity Relationship model .in this model data is stored as tables.
• Entity-It it real world object
• Attribute-It is the characteristics of an entity
• Relation-A relation is a two dimensional table
• Relationship-It is the connection between two tables
In a table there are rows and columns Rows are also called as Tuples and columns are also called as Attributes
MYSQL
It is the most used RDBMS
DCL Commands
1. GRANT
2. REVOKE