Informatics Practices (Part-2)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

20

DIFFERENCIATED TASK
Give the output of the following when
numl = 4, num2 = 3, num3 = 2
a) numl += num2 + num3
b) print (numl)
c) numl = numl ** (num2 + num3)
d) print (numl)
e) num I num2 + c
f) numl = '5' + '5'
g) print(numl)

i) numi =
j) print(numl)
k) numl = float(10)
l) print (numl)
DATE •

/lllclhplc PAGE'
DATE:
pAGE:
DATE:
PAGE:

33 > Os
9
(3

a salesman. The Discount


the Discount and NetAmount in Rupees for
write a Python program to print
ts based on the following conditions:
Discount_Percentage

?5000 5%
tsooo to ?10000
Above uOOOO 10%

Calculateand print the following;


Dtscount Sales • Discount_Percentage / 100
NetAmount Sales - Discount
The Tax and Surcharge
Wrttea Python program to print the Income, Tax & Surcharge of Employ.
based on the following conditions
Tax_Per Surcharge_Per

< usooo 15% 7%


usoot to R20000 18% 11%
Above t21000 20% 13%

lax income • Tax Per/iOO


Sur&.aree= income • Surcharge_Per/100
Net income income (Tax+Surcharge)
Displayall unformationlike Income, Tax. Surcharge and Net_lncome.
unit distributions.
Write a program to calculate monthly electric bill charges according to the following
First 100 units :
Next 200 Units ; t2
Above300 units : t4
Wnte a program to get input distance and print fare for the passenger according to:
Distance Fare per Km (in t)
up to 10
Next' 20krn
6
using following
Write • program to calculate the fine for library when a member returns a book in late

Firq five days : per day.


Six to ten day : per day.
Above ten days : per day
DAIC:
PAGE

00

4 (ÒOoò

is

100
DATE:
PAGE •

4,

1 // ANS: Oslo

2% ANS:
ANS:

4
Assign a value to the salary variab e.
DOD
Assign a value to the bonus variab
5
ANS: SODO
Calculate the total pay by adding salaryand bonus. ssign the
6
result to pay. ANS: b-
7 Display the pay. ANS:

1 Get the user's first name. ANS:


2 Get the user's last name. ANS:

3 Print a greeting to the user. ANS:


Write a program to input roll number, name and four different marks of five friends. Find
thet
and its percetitåge,w
Write a program to enter employee's number,'name 'and salary. Calculate the DÅ, HRA an
salary, whereas the' DA and HAA are:
Salary HRA

(10000 10%
05000 15%
4.

?20000
Gross salary DA HRA,
Correct the following code:
temperature input ("Temperature:
if temperature 00'
prnt "It is hot outside."
Correct the following code:
oscflnput Input ("A cherry is a: ")
pr.nt ("A. Dessert topping t')
print C'B. Desert topping
if userlnput
print "Correct !"
What two things are wrong in the following code?
input ("Enter a number :

print ("You entered 3")


Write a Python program that will take in a number from the user and print if it is positive, negativ
or zero.
Write a program to enter the marks of n students in three subjects. Calculate the total marks
each student and find who scores the highest marks.
Write a Python program to find the median of three values.
Write a program to find the ticket fair of a bus according to the code of a bus:
Code Fair (C)
d 10
15
20
c 25
Write a Python program to assign a stream to student according the input of three subjects' mar
[English, Maths and Science] of class - X:
Marks obtained in different subject Stream
English. Maths and Science >=80% Pure Science
English and Science Maths>=60% Bio. Science
English. Maths and Science Commerce

Control Structures
I Understand
Need Fairly Very
Topic / Lesson Objective but need to
Help Through Through
Understand the concept and usage of selection and iteration statements.
2 Appreciate the need and use of Relational and Logical operators
3 Analyze the problem, decide and evaluate conditions

I need to work on :
DATE:
PAGE:

tこ) 。
斗とう


ゝ( く 。
れh ん乙 ゞなみ'
ゾⅣノ




PAGE:
PAGE:

C'Êth) *R-2

b&e2-
DATE:
PAC,r,

he-u

CLASS TEST
if a and b —2and c —3 then a • c evaluate to :
d) 15

A python express•on contains :


a ) (hly Operator b) Only Operands
shoth (herators and Operands d) None of these

% is known as the modulus operator and if a —13and b =2 then a % b evaluate to


(a) False, O b) True, 6 c) True , None Mone of These

if a—3 and b th ( a > b and b>a) evaluate to :


(a)True alse c) True and True d) None of these

Out of following which is not a bitwise operator :

State true or false the statement : operator is evaluate right to left and • is left to

True b) False c) True and False d) None of These

Introduction to Python
Topic / Lesson Objective I Understand
Need Fairly
1 Understandwhat are but need to Very
Python Keywords Help Through Through
2 use of identifiers and revise
vanables
3 Understand and use Data
Types
4 appreciate the various
Operators
5 Understand Expressions
6 Understand the input and
Output
7 Examine the if.glse
Statements
8 Examine the for Loop
& while loop
I need to work on :
Lis (s DATE: IT/
PAGE

LISTS
Sl Topic / Lesson Objective

Understandthe concept of mutable sequencetypes in


p hon.
Appreciate the use of list to convenientlystore a large
amount of data in memory.
3 Create, access & manipulate list 0b ects
4 Use various functions & methodsto work with list
Appreciate the use of index for accessing an element
from a sequence.

CRstY
DATE: 023/ •

pAGE :

AFL
What will be the output of the following
statements?

i) listl = 101
listl.sort()
print(listl)
listl = 101
sorted(listl)
print(listl)
k) listl

listl =

t) It 2
DATE'
PAGE:

t What wit! the following code display?


numbers (i, 2. S, a, S)
my.list numbersIt.31

2 What will the following code display?


numbers (t, 2, 3, 4, 51
numbers(l:)
prin my_rtst)
Ans

3 W'hat will the following code display?


numbers = (1, 2, 3, 4, 51
my_list = numbersl:l)
print(my_list)
Ans

Gtve the POST


output of the ASSESSMENT
Itst: following code:
'Magenta'
'Yellow','Black'J

S listl(7üJ
DATE
PAGE:

POST ASSESSMENT
1 What will the following code display?
numbers = Il, 2, 3, 4, 51
my_list = numbers[1:31
print(my_list)
Ans

2 What will the following code display?


numbers = (1, 2, 3, 4, 51
my_list = numbersll:l
print(my_list)
Ans //
3 What will the following code display?
numbers = [1, 2, 3, 4, 51
my_list =

Ans

(71

CRS
t)ArE.
PAGE •

Mc/%o

In'Jh>5
4

( to ~0
tD 40 1

0
り) い

) は均 (0 ~0

0な
お 【
0 0 0い
2さやの 朝
)ら

う) こ 0 20ー

(の气0 谷0
DATE:
pAGE :

-c
sum=sum+c
c

Output Questions Iterative Statements Class 11

10
> 90
while

print(a)

2.

for i in '678'/
print( 'CS Class

3.

for i in
print(i**2)

4.

while 1<4:

for j in range(i):
PAGE:

List.append(eiem)
A ppend
ListMtend(list2)
Extend

Insert
List.reverse()
Reverse
List.index(elem)
Index
OPERATIONS
List.sort()
Sort
List.remove(eiem)
Remove

Fig. 5.11: Built-in List operations

or False.
following statements are True
State whether the
dynamically-typed language. shel
(a) python is a command in Python
repeat the last typed
(b) Att+R is used to
same in Python.
(c) Print and print are method.
sep argument is used with print()
W) The
high-level language.
(e) Python is a compiled
language.
(f) Python is a cross-platform language.
interpreted language, not a compiled
(g) Python is an
free, open-source and portable language.
(h) Python is a
Python.
Python Editor refers to Script mode in
(i) Python.
shortcut key combination is used to exit
(j) Ctri+Q
(MCQs):
ultipie Choice Questions
by
(a) Python was developed
(i) Charles Babbage
(ii) Guido van Rossum
(iii) Tim Berners Lee
(iv) Robert E. Kahn

OBJECTIVE TYPE QUESTIONS


I. Fill in the blanks.
(a) are the set of instructions given to a computer to perform a particular task.
(b) Python was developed by
(c) Python is called a/an language.
(d) Python is a/an. language in terms of its syntax.
(e) Jn Python, a syntax error is detected by the at
(f) Python is a/an independentlanguage.
(g) To start Python from the command prompt, use the command,
(h) Python progfams are saved using the or extension.
(i) Python programming can be done jn and modes,
mode does not save the commands entered by you in the form pf a program.
(k) The shortcut key to run Python script i;
DATE:
PAGE:

OBJECTIVE TYPE QUESTIONS


i. Fill in the blanks.
(a) Statements in Python are executed while working with a sequence construct.
(b) are diagrams that show the step-by-step solution to a given problem.
(c) The most popularly used looping constructs in Python are and
(d) loop is the best when the number of iterations is known.
(e) statements let us write a program to do differenttasks or take different pathS
based on the outcome of the conditions.
(f) A loop that never ends is called an loop.
(g) The construct means repetition of a set of statements depending upon a condition tests
(h) The statement is used to iterate over a range of values or a sequence.
(i) The statements within the body of for loop are executed till the of values is exhausted.
line begins with a keyword and ends with a colon.
From the eset and digpiay whethet vowel
ach

a vowei•)

e ,, as a eer.se.-;ant")
Write a Python prqram to find those numbers which are divisible by and multiples of 5 between IS
and (both included).
tex x range (iSOC. 2701) :
and :
{x)
Write Python prqram that accepts a word from the user and reverses it.
• I• Input a word to reverse: • )
char in range (len (word) - I, -
end•••)

Wrke a pt'%ram to count ete number of even and odd numbers from a series of numbers starting
$ 90.
odd O
zanøe(S.10i) :

even+—i
else:
print of even numbezs :• , count even)
of odd nu&ers :% count odd)
WAP goe user and print the table of that number.
*Pyt.boa to Print Multiplication Table of a Number
inc the number; )
table of % rnn)

num • I)
-WAPto print series up to certain Emit.
'Program to print Fibonacc4 ser See
a—int (input ( •enter Cbe terns") )
•first eleent of series
•second eleent of series
print (f, g, end— e 9)

gor in Fange (2, n) :


next—f+s
print (next, end—

s—next
DATE:
REINFORCEMENT OF PYTHON BASICS

1. The return type of input() function is


string b.integer c. list d.float
2. Find the valid identifier from the following:
a. True name c. type d.None
3. Predict the output:
A-IO
while(A>5):
print(A,end=

a. 1098765 109876 c. 9 765 d.987654


4. Which of the following s mbol is us In python for single line comment?

5. Find the valid logical operator in


b.!= F/and d.in
6. Which of the following is/are not legal ring operators?
in d./
7. Which of the follpwing functions will return the string caps?
a.isupper() U.upper() c.capitalize() d.all of these
8. How many bytes are there in 1011 001 1101 0101 numbers?

9. The value of radix in dec)mal numbe ystem is


c. 16 a. 10
10.Find the output of the following source code:

for i in range(1,10,2):
C+=2
print(c)
c.i6 d.10
11.What is the correct expansion of IDLE?
. Integrated Development Learning Environment
b. Interact Development Learning Environment
c. Internet Development Learning Environment
d. Integrated Direct Learning Environment
12.Find the output of the following code:

b=b+2

c-=b
print(a,b,c)
a. 12 22 27 b. 12 22 8 c. 10 20 30 d.30 20 10
13.Which of the following option is incorrect?
score.
a. The first character must be a letter or under
except underscore.
b. An identifier cannot contain any special character
Inct.
c. Upper and lower-case letters are treat as cf
x_/An identifier must be a keyword.
14.The can be used to get the memory address of a variable.
b. id() c. int() d. str()
a. type()
python code:
15. What will be the output of the following

You might also like