0% found this document useful (0 votes)
2 views7 pages

Python Notes (Set 1)

This document provides an overview of basic programming concepts suitable for class 7 students, including definitions of programs, programmers, and programming languages. It specifically focuses on Python as a high-level language, detailing its features, syntax, and common functions like print() and input(). Additionally, it covers variable naming conventions and provides example outputs for basic arithmetic operations.

Uploaded by

Breson . JR
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)
2 views7 pages

Python Notes (Set 1)

This document provides an overview of basic programming concepts suitable for class 7 students, including definitions of programs, programmers, and programming languages. It specifically focuses on Python as a high-level language, detailing its features, syntax, and common functions like print() and input(). Additionally, it covers variable naming conventions and provides example outputs for basic arithmetic operations.

Uploaded by

Breson . JR
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

PYTHON Notes for class 7

[Link] is a program?

Set of instructions to solve a particular problem is called a program.

[Link] is a programmer?

The person who writes the program is known as a programmer.

[Link] is a programming language?

The language used to write the set of instructions(programs) to solve a


problem is called programming language.

eg-: java,python,c,c++ etc.

[Link] are the two types of Programming languages?

1)Low level language[LLL]

2)High level language[HLL]

[Link] the difference between high level language and low level language?

LOW LEVEL LANGUAGE(LLL) HIGH LEVEL LANGUAGE(HLL)

Machine friendly languages User friendly languages

Harder for humans to understand Easy for humans to understand

No translation is required Requires translation into LLL


before execution

Use 0's and 1’s Use English like words

Used to control the hardware of the Used to develop application


computer programs like making
games,websites and analyze data
[Link] is PYTHON?
Python is a high level language that is easy to learn and simple to [Link] is
a ‘batteries included’ language which means that it comes with a lot of pre
installed features. Python was created by GUIDO VAN ROSSUM and first
released in 1991.
7. What are the features of python?
[Link] to read , learn and maintain
2. It is a portable language-It can be used on a variety of platforms.
[Link] typing-Python defines data types dynamically for the objects
according to the values assigned
[Link]-source language
[Link] execution mode-python offers script and interactive modes
for running the programs.
[Link] application creation-Python also supports the creation of Graphical
User Interface applications.
[Link] is SYNTAX?
A programming language has its own set of rules that is referred to as
syntax(grammar of programming language).
One important rule in python is that it is a case sensitive
language(uppercase and lowercase letters are treated differently).

Eg Num,num ,NUM ,nUm etc are different variables.

[Link] do you mean by syntax errors?


Syntax errors occur when we are not following the rules to write the codes.
eg:wrong function names,missing quotes ,brackets etc

[Link] is the use of Comments and mention two types of comments.


We use comments to add documentation to a python program.A comment
is a text that doesn't affect the outcome of a code. It is just a piece of
information to let someone know what you have done in a program or what
is being done with a block of code.

11. Which are the two types of comments?


Single line comment and multi line comment
# symbol is used to write a single line comment.
Eg-:
#program to find the sum of two numbers
Multi line comment begins and ends with three single or double quotes
( ’ ’ ’ or ”” ”)
eg-:
’ ’ ’ program to find the sum,difference ,product and quotient and
remainder of two numbers ’ ’ ’
[Link] do you mean by Built -in Functions?
A function is a block of code to perform a specific task.
Built-in functions are those functions which can be used without the need
to define them
Eg: print()
The print() displays a value or information in the output
Syntax : print( “ value”).
print ( “ Hello”) will give Hello as output.

13)What is a variable?

A variable is a named location, used to store data in the memory. It is


helpful to think of variables as containers that hold data that can be
changed later, throughout the program.
eg: a=5
name =”John”
[Link] are the rules to name variables ?
[Link] can be a combination of letters in lowercase(a to z) or
uppercase(A to Z) or digits(0 to 9) or an underscore(_).
2.A variable cannot start with a digit.(Eg: 1Variable is invalid, but
variable1 is valid) It must start with a letter or underscore.
[Link] cannot be used as variables
3. variable name must not contain any white-space, or special
character (!, @,#, %, ^, &,$, *).
4. variables can be of any length
[Link] names are case sensitive.
for example, myname and MyName are not the same.
*Examples of valid variables: a123, _n, n_9, etc.
* Examples of invalid variables: 1a, n%4, n 9, etc.

[Link] is a case sensitive language. What is the meaning ?


In python,the upper case and lower case letters are treated differently .
for eg-:myfile and MYFILE- both are different variable names.

[Link] is the use of print () function.

The print () function is used to print the message or value of the variable on
the screen. The syntax of print() function is

print (“message, variable name)

Examples

1)To print a message like “Welcome to Python” on the screen

print(“Welcome to python”)

2)To print value of a variable like a = 5

print(“The value of a is:”, a)

[Link] is the use of input () function.

The input() function is used to take input from the user during the
execution of the program. By default, it takes the input in the form of a
string. The syntax of input () function is

input(prompt), here prompt is a message for the user related to the code.

Example:

x = input (“What is your name?”)

In this example the input function will display

“What is your name” on the screen to get the input from the user and
store/assign it to in the variable x.

Note: By default, input () function takes the input in the form of a string. So,
to take the numeric value as input, you need to convert it into integer.
Example

x = int (input (“What is your age?”)

[Link] do you mean by a Camel Case And Snake Case style in variable
naming?

These are two case styles in naming variables.

Camel case

The first letter of the variable in lowercase and each subsequent word’s
first letter is [Link] space in between

Eg:

nameOfTheCompany=”Biotech”

Snake case

All letters are in lowercase and words are separated by underscores.

Eg:

name_of_the_company=”Biotech”

[Link] THE OUTPUT


QUESTION 1.
a = 10
b=3
result = a+b
print(“sum :”, result)
OUTPUT
sum : 13
QUESTION 2
a = 10
b=3
result = a-b
print(“a-b :”, result)
OUTPUT
a-b : 7
QUESTION 3
a = 11
b=2
result = a/b
print(“quotient= :” , result)
OUTPUT
quotient= : 5.5
QUESTION 4.
a = 10
b=3
result = a%b
print(“ remainder : ”, result)
OUTPUT

remainder: 1

QUESTION 5

a=2
b=3
result = a**b
print(“answer= : “, result)
OUTPUT
answer= : 8
QUESTION 6.
a = 11
b =2
result = a//b
print(“answer= : “, result)
OUTPUT
answer= : 5

You might also like