0% found this document useful (0 votes)
13 views

Grade 7- Introducing Python- Part_1

Chapter 6 introduces Python as a simple, high-level programming language created by Guido Van Rossum in 1991. It covers the basics of programming languages, the installation process for Python, and its features, applications, and usage of variables. The chapter also explains the Python IDLE environment and the importance of syntax and variable naming rules.

Uploaded by

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

Grade 7- Introducing Python- Part_1

Chapter 6 introduces Python as a simple, high-level programming language created by Guido Van Rossum in 1991. It covers the basics of programming languages, the installation process for Python, and its features, applications, and usage of variables. The chapter also explains the Python IDLE environment and the importance of syntax and variable naming rules.

Uploaded by

shailajajirs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

Chapter - 6

Introducing
Python
What is a Programming
Language
☞ English, Kannada, Hindi are natural languages.
It has words, symbols and grammatical rules.
☞ A programming language is set of instructions
given to computer to perform a particular task.
☞ A programming language also has words,
symbols and rules of grammar.
☞ The grammatical rules are called SYNTAX.
☞ Modern computers can follow the generalized
set of operations called programs.
☞ A program is an sequence of instructions that
specifies how to perform a computation.
RECIPE FOR TOMATO PASTA

The recipe is a set of instructions on what to do, how to do,


when to do. The set of instructions uses ingredients (inputs)
to make Tomato Pasta(output).
Adding all the
requite
ingredients to
the recipe is

Simmering the
ingredients is

The product
after processing
is output, in our
example pasta.
Programming language
Introduction to
Python
⮚ Python is a simple programming
language used to write codes for
computer programs.
⮚ Python was created by Guido Van
Rossum when he was working at CWI
(centrum Wiskunde & Informatics),
which is a National Research Institute
for Mathematics and Computer
Science in Netherlands. The language
was released in 1991.
⮚ Python is a high-level programming
language.
Some of the features which make
Python so popular are as follows:

✔ It is an easy to learn general-purpose


programming language.
✔ It is platform independent programming
language.
✔ It has a simple syntax.
✔ Case sensitive language
✔ It is an interpreted language.
✔ It is free to use and even for commercial
products.
Applications/uses of Python

❖ Build a website
❖ Develop Games
❖ Program Robots
❖ Perform Scientific
Computations
❖ Develop Artificial Intelligence
Applications.
Installing Python
🞇 Step 1. Go to website address
http://www.python.org/download
Step 2. Python Installation Process
⮚ Click on RUN in the dialog box the installation process starts.
⮚ Keep following the instructions and keep clicking on next
button until you see the highlighted Finish button.
The Python IDLE
(Integrated Development
Click on and Learning Environment)
IDLE Executes instructions, one
Python line at a time.
Components of Python
Window
Title Bar Menu Bar

Python
Prompt
Script Area

Status Bar
Components of Python
Window
✔ Title Bar
✔ Menu Bar
✔ Working with File Menu
✔ Working with Edit Menu
✔ Working with Help Menu
✔ Script Area
✔ Status Bar
Two Modes

Interactive Script
Mode Mode

Script mode is used


to write lengthy
programs
Where you
see Python
Prompt
WORKING IN PYTHON
Interactive Mode

e is
Interactive mod
beneficial for
ere
testing code wh
you type the
at a
c om m a n d s o n e
e
time and get th
result or error
immediately.
Use of Interpreter

The commands are executed line by line in the


interactive mode of Python. When you type a program
next to the python prompt(>>>) and press Enter key,
the interpreter converts the machine code into human
readable form(output)
Using print () function
The print() function is used to display the output
of any command on the screen. It can also be
used to print the specified message.

In Python we can also pass more


than one argument to the print
function. In such cases we use
comma as a separator. Python is Case-sensitive
Example: print is a valid
command, while Print is
just a word not a
command.
Separated arguments by
commas.
Using IDLE as a calculator

To perform arithmetic operations, it is not necessary to use


print() function. The basic BODMAS rules are followed for
performing calculations.
Practice Time
Variables General Example of
Variable

•Variables represent
named storage
locations.

Empty Storage
A variable can locations
store only one
data value at a
time.
A storage
holding a
food.
The Assignment Operator(=)

•Python variables
are created by
assigning values
of desired type to
them.
Ex: x=42
▪ A variable
name can be of
any length
▪ Variable names
are case-
sensitive
▪ If a variable is
used without
assigning a
value, it gives
an error.
Rules to write the variable names
or Identifiers.
⮚ The first character must be a letter
⮚ Upper case and lower case are different.
⮚ Digits (0 to 9) can be a part of identifies except first
character.
⮚ It can’t be a keyword of python.
⮚ Can’t contain any special character except
underscore(_).
🞇 The following characters are valid:
🞇 Lowercase letters (a to z)
🞇 Uppercase letters (A to Z)
🞇 Digits (0 to 9)
🞇 Underscore (_)
Examples of
Valid Variable names Invalid Variable names
🞇 Class
🞇 Employee code
🞇 emp_code
🞇 10code
🞇 age1980
🞇 A.B.C Ltd
🞇 a145r
🞇 tm@ltd
🞇 Four
🞇 Else
🞇 bal_fee
Swapping variables:
a, b = 30, 50
print (a, b) # 30 50
a, b = b, a
print (a, b) # 50 30

Other programming language

You might also like