100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

Python Programming language model paper:-01

Rating
-
Sold
-
Pages
28
Uploaded on
01-04-2023
Written in
2022/2023

I will give you the nice python programming notes so you can easy to learn and improve you coding skills and also give you the all basic coding notes if you guys want to learn easy then perched my notes. I was full struggle for this notes and I have full experience you guys have any daut the DM me.

Show more Read less
Institution
Course










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Course

Document information

Uploaded on
April 1, 2023
Number of pages
28
Written in
2022/2023
Type
Class notes
Professor(s)
Python programming model paper 2023
Contains
All classes

Subjects

Content preview

MODEL QUESTION PAPER-1


Max Marks: 60
Time: 2 1/2 Hours
Instruction: Answer any 4 Questions from each Part
PART-A
I. Answer any Four questions. Each question carries 2 Marks. (4×2=8)
1. What is the purpose of indentation in Python?
Python indentation refers to adding white space before a statement to
a particular block of code. In another word, all the statements with the
same space to the right, belong to the same code block.
If proper indentation is not given then we will end up seeing
indentation errors and the code will not get compiled.


2. Define the "if..elif..else" decision control statement in Python.
The if else statement is used to execute a block of code among two
alternatives. However if we in to make a choice between more than
two alternatives, then we use the if elif else statement The if elif else
statement is a multi-way decision maker which contains two or more
branches from which any one block is executed.
Example:


marks = int (input("Enter the marks :"))
if marks> 85 and marks <=100:

, print("Congrats! You scored grade A")
elif marks>60 and marks<=85:
print("You scored grade B+")
elif marks> 40 and marks <=60
print("You scored grade B")
elif marks>30 and marks<=40
print("You scored grade C")
else print("Failed")


Output:
Enter the marks 89 Congrats!! You scored grade A
Enter the marks: 67
You scored grade B+
Enter the marks:14
Failed


3. What is the difference between a list and a tuple in Python?

SR.NO. LIST TUPLE

1 Lists are mutable Tuples are immutable

The implication of iterations is Time- The implication of iterations is
2 consuming comparatively Faster

, SR.NO. LIST TUPLE

The list is better for performing
operations, such as insertion and Tuple data type is appropriate
3 deletion. for accessing the elements

Tuple consumes less memory
4 Lists consume more memory as compared to the list




4. Explain the built-in functions used on dictionaries in Python
1) len(): The len() function returns the number of items (key:value
pairs) in a dictionary.
Syntax: len(dictionary_name)
>>> myDict = {1: 'A', 2: 'B', 3: 'C', 4: 'D'}
>>> len (myDict)
4


2) any(): The any() function returns Boolean True value if any of the key
in the dictionary is True else returns False.
Syntax: any(dictionary_name)
>>> myDict = {1: 'A', 2: 'B', 3: 'C', False: 'D'}
>>> any (myDict)
True
>>> myDict = {0: 'A', False: 'B'}
>>> any (myDict)
$9.19
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
ajeetkumar2

Get to know the seller

Seller avatar
ajeetkumar2 Surana Degree College Bangalore University
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions