Advanced Python Class 10 Notes

Teachers and Examiners (CBSESkillEduction) collaborated to create the Advanced Python Class 10 Notes. All the important Information are taken from the NCERT Textbook Artificial Intelligence (417).

Advanced Python Class 10 Notes

advanced python class 10

Recap 1: Jupyter Notebook

For interactively creating and presenting projects linked to AI, the Jupyter Notebook is a really powerful tool. The open source web application Jupyter Notebook allows users to create and share documents with live code, equations, visualisations, and text.

Through Anaconda, Jupyter Notebook may be installed and used most easily. The most popular Python distribution for data science, Anaconda, comes pre-installed with all the most used tools and libraries.

Introduction to Virtual Environments

By creating separate Python virtual environments for each project, a virtual environment is a tool that aids in maintaining the separation of dependencies needed by various projects. The majority of Python developers utilise this as one of their most important tools.

Steps for creating Virtual Environments 

Step 1 : Open Anaconda prompt

Step 2 : As we open the Anaconda prompt, we can see that in the beginning of the prompt message, the
term (base) is written. 

Step 3 : Type “conda create -n env python=3.7” in command prompt

Step 4 : After processing, the prompt will ask if we wish to proceed with installations or not. Type Y
on it and press Enter.

Step 5 : Packages will start getting installed in the environment.

Step 6 : Once an environment has been successfully created.

Step 7 : Type “conda activate env” in command prompt

Advanced Python Class 10 Notes

Recap 2: Introduction to Python

Guido Van Rossum, of Centrum Wiskunde & Informatica, is the inventor of the Python programming language. The language, which took its name from the 1970s BBC comedy series “Monty Python’s Flying Circus,” was made available to the general public in 1991. It can be used to programme in both an object-oriented and procedural manner. Because it offers so many features, Python is very popular.

Easy to learn, read and maintain

Python has few keywords, simple structure and a clearly defined syntax. Python allows anyone to learn the language quickly. A program written in Python is fairly easy-to-maintain.

A Broad Standard library

Python has a huge bunch of libraries with plenty of built-in functions to solve a variety of problems.

Interactive Mode

Python has support for an interactive mode which allows interactive testing and debugging of snippets of code.

Portability and Compatibility

Python can run on a wide variety of operating systems and hardware platforms, and has the same interface on all platforms.

Extendable

We can add low-level modules to the Python interpreter. These modules enable programmers to add
to or customize their tools to be more efficient.

Databases and Scalable

Python provides interfaces to all major open source and commercial databases along with a better structure and support for much larger programs than shell scripting.

Applications of Python

There exist a wide variety of applications when it comes to Python. Some of the applications are:

1. Application of Python
2. Web and Internet Development
3. Desktop GUI Applications
4. Business Application
5. Software Development
6. Games and 3d Graphics
7. Database Access

Advanced Python Class 10 Notes

Recap 3: Python Basics

Keywords & Identifiers

Some terms in Python have predefined meanings that the computer automatically assigns to them. These phrases are referred to as keywords. In order to avoid misunderstanding and unclear results, keywords should only be used in the default manner and cannot be changed at any point in time. The following list includes a few of the keywords:

Example of Keywords –

False, class, finally, is, return, None, continue, for lambda, try, True, def, from, nonlocal, while, and, del, global, not, with, as, elif, if, or, yield, assert, else, import, pass, break, except, in, raise etc.

Variables & Datatypes

Variables 

A variable is a memory location where you store a value in a programming language. In Python, a variable is formed when a value is assigned to it. Declaring a variable in Python does not require any further commands.

There are a certain rules and regulations we have to follow while writing a variable

  1. A number cannot be used as the first character in the variable name. Only a character or an underscore can be used as the first character.
  2. Python variables are case sensitive.
  3. Only alpha-numeric characters and underscores are allowed.
  4. There are no special characters permitted.

Advanced Python Class 10 Notes

Constants

A constant is a kind of variable that has a fixed value. Constants are like containers that carry information that cannot be modified later.

Declaring and assigning value to a constant 

NAME = “Rajesh Kumar” 

AGE = 20

Datatype 

In Python, each value has a datatype. Data types are basically classes, and variables are instances (objects) of these classes, because everything in Python programming is an object.

Python has a number of different data types. The following are some of the important datatypes.

  1. Numbers
  2. Sequences
  3. Sets
  4. Maps

a. Number Datatype

Numerical Values are stored in the Number data type. There are four  categories of number datatype –

  1. Int – Int datatype is used to store the whole number values. Example : x=500
  2. Float – Float datatype is used to store decimal number values. Example : x=50.5
  3. Complex – Complex numbers are used to store imaginary values. Imaginary values are denoted with ‘j’ at the end of the number. Example : x=10 + 4j
  4. Boolean – Boolean is used to check whether the condition is True or False. Example : x = 15 > 6      type(x)

Advanced Python Class 10 Notes

 b. Sequence Datatype

A sequence is a collection of elements that are ordered and indexed by positive integers. It’s made up of both mutable and immutable data types. In Python, there are three types of sequence data types:

  1. String – Unicode character values are represented by strings in Python. Because Python does not have a character data type, a single character is also treated as a string. Single quotes (‘ ‘) or double quotes (” “) are used to enclose strings. These single quotes and double quotes merely inform the computer that the beginning of the string and end of the string. They can contain any character or symbol, including space. Example : name = ”Rakesh kumar”
  2. List – A list is a sequence of any form of value. The term “element” or “item” refers to a group of values. These elements are indexed in the same way as an array is. List is enclosed in square brackets. Example : dob = [19,”January”,1995] 
  3. Tuples – A tuple is an immutable or unchanging collection. It is arranged in a logical manner, and the values can be accessed by utilizing the index values. A tuple can also have duplicate values. Tuples are enclosed in (). Example : newtuple = (15,20,20,40,60,70)

c. Sets Datatype

A set is a collection of unordered data and does not have any indexes. In Python, we use curly brackets to declare a set. Set does not have any duplicate values. To declare a set in python we use the curly brackets.

Example : newset = {10, 20, 30}

d. Mapping

This is an unordered data type. Mappings include dictionaries.

Dictionaries 

In Python, Dictionaries are used generally when we have a huge amount of data. A dictionary is just like any other collection array. A dictionary is a list of strings or numbers that are not in any particular sequence and can be changed. The keys are used to access objects in a dictionary. Curly brackets are used to declare a dictionary.  Example : d = {1:’Ajay’,’key’:2} 

Advanced Python Class 10 Notes

Operators 

Operators are symbolic representations of computation. They are used with operands, which can be either values or variables. On different data types, the same operators can act differently. When operators are used on operands, they generate an expression.

 Operators are categorized as –

  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Logical operators
  • Identity operators
  • Membership operators
  • Bitwise operators

Arithmetic Operators

Mathematical operations such as addition, subtraction, multiplication, and division are performed using arithmetic operators.

Operator 

Meaning 

Expression 

Result

+

Addition

20 + 20

40

Subtraction

30 – 10 

20

*

Multiplication

10 * 100

1000

/

Division

30 / 10

20

//

Integer Division

25 // 10 

2

Remainder

25 % 10

5

** 

Raised to power

3 ** 2

9

Assignment Operator

When assigning values to variables, assignment operators are used.

Operator 

Expression 

Equivalent to

=

x=10

x = 10

+=

x += 10

x = x + 10

-=

x -= 10

x = x – 10

*=

x *= 10

x = x * 10

/=

x /= 10

x = x / 10

Advanced Python Class 10 Notes

Comparison Operator

The values are compared using comparison operators or relational operators. Depending on the criteria, it returns True or False.

Operator

Meaning

Expression

Result

>

Greater Than

20 > 10

True

  

20 < 50

False 

<

Less Than

20 < 10

False 

  

10 < 40

True

==

Equal To

5 == 5

True

  

5 == 6

False

!=

Not Equal to

67 != 45

True

  

35 != 35

False

Logical Operator 

Logical operators are used to combine the two or more then two conditional statements –

Operator

Meaning

Expression

Result

And

And Operator

True and True

True

  

True and False

False

Or

Or Operator

True or False

True

  

False or False

False

Not

Not Operator

Not False

True

  

Not True

False

Employability skills Class 10 Notes

Employability skills Class 10 MCQ

Employability skills Class 10 Questions and Answers

Artificial Intelligence Class 10 Notes

Artificial Intelligence Class 10 MCQ

Artificial Intelligence Class 10 Questions and Answers

Leave a Comment

error: Content is protected !!