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

Python Programming Assignment Guide

This document outlines a Python programming assignment for BCS TY (V Sem) students at Shri Shivaji College Parbhani. It includes various tasks related to Python data types, decision-making statements, looping statements, and more, with specific programming exercises for each topic. Additionally, it provides guidelines for submission and formatting requirements for the assignment record book.

Uploaded by

omkarbarhate755
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)
19 views7 pages

Python Programming Assignment Guide

This document outlines a Python programming assignment for BCS TY (V Sem) students at Shri Shivaji College Parbhani. It includes various tasks related to Python data types, decision-making statements, looping statements, and more, with specific programming exercises for each topic. Additionally, it provides guidelines for submission and formatting requirements for the assignment record book.

Uploaded by

omkarbarhate755
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

.

M S.P. MANDAL’S

SHRI SHIVAJI COLLEGE PARBHANI


DEPARTMENT OF COMPUTER SCIENCE
Python Assignment Questions

CLASS: BCS TY (V Sem) 2024-25 Subject: PYTHON PROGRAMMING(BCS507)

Q.1 To study different data types in python. [ write description]


a) W.A.P to perform addition of two numbers by taking input from keyboard.
b) W.A.P to find area of circle
c) W.A.P to find square root of given number.

Q.2 To study decision making statement of python. [ write description]


a) W.A.P to check given number is even or odd using if statement.
b) W.A.P to check a person is eligible to vote or not using if-else statement.
c) W.A.P to find largest among three numbers using nested if statement.
d) W.A.P to display result rank such as distinction, first class, second class, pass or
fail based on marks using if-elif-else statement.
Q.3 To study looping statements in python. [ write description]
a) W.A.P to print multiplication table using while loop.
b) W.A.P to print numbers by taking range from user using FOR loop.
c) W.A.P to print even numbers from 1 to 50 by taking number & divisor from user

Q.4. To study breaking statements in python. [ write description]


a) W.A.P to demonstrate break statement.
b) W.A.P to demonstrate continue statement.
c) W.A.P to demonstrate pass statement.
Q.5. To study list connections in python. [ write description]
a) Write a Python program to demonstrate all list methods().
b) Write a Python program to add two list elements

Q.6. To study tuple connections in python. [ write description]


a) Write a Python program to demonstrate all tuple methods().
b) Write a Python program to compare two tuples.

Q.7. To study set connections in python. [ write description]


a) Write a Python program to demonstrate all set methods().
b) Write a Python program mathematical operations on two set.

Q.8. To study dictionary connections in python. [ write description]


a) Write a Python program to demonstrate all dict methods().
b) Write a Python program to find sum of all items in a dictionary.

Q.9. To study strings in python[ write description]


a) Write a Python program to display how many times a particular letter appears
in the string.
b)Write a Python program to concatenate two string.
c) Write a Python program for string slicling.

Q.10. To study functions in python. [ write description]


a) Write a Python program to demonstrate function declaration and passing
arguments
b) Write a Python program for creating simple calculator using function

Q.11. To study modules in python. [ write description]


a) Write a Python program to show use of modules

Q.12. To study packages in python[ write description]


a) write a Python program to demonstrate packages

Q.13 To study classes in Python[ write description]


a) Write a Python program to create class student with member variable Stu_Id,
Stu_Name, Stu_Marks
b) Write a Python program demonstrate class in python.

Q.14 To study assignment statements[ write description]


a) Write a Python program to demonstrate different assignment statements in
python

Q.15. To study Data Structure in python[ write description]


a) Write a Python program to demonstrate array

Q.16. To study inheritance in Python. [ write description]


a) Write a Python program for single inheritance
b) Write a Python program for multi-level inheritance
c) Write a Python program for multiple inheritance

Q.17. To study polymorphism in python. [ write description]


a) Write a Python program to demonstrate polymorphism

Q.18. To study Exceptional Handling [ write description]


a) Write a Python program for exceptional handling

Q.19. To study Database Connectivity in Python [ write description]


a) Write a Python program to demonstrate database connectivity in python.

Q.20. prepare any one mini project [ as per your choice]

NOTE:
• All given questions are based on syllabus
1. Prepare record book (manual) in printed format. No handwritten record book will be
accepted at the time of examination.
2. Prepare it in proper manner. Attach front page,certificate,index and aim page for each
3. Use font face “Calibri” and font size “12” (bold for headings), simple page border.
4. Attach printout of given programs with output.
5. Bring for checking before spiral binding.
6. Last date of submission is 14th October 2024. After this it will be NOT acceptable at any
cost.
7. Sample format of assignment no 1 is attached below.
[ add page simple border here]

Assignment No:-01
Aim: - To study different data types in python..

Description:

Every value has a data type, and variables can hold values.
Python is a powerfully composed language; consequently, we
don't have to characterize the sort of variable while announcing
it. The interpreter binds the value implicitly to its type.

Standard data types

A variable can contain a variety of values. On the other hand, a


person's id must be stored as an integer, while their name must
be stored as a string.

The storage method for each of the standard data types that
Python provides is specified by Python. The following is a list of
the Python-defined data types.

• Numbers
• Sequence Type
• Boolean
• Set
• Dictionary

1. Numbers

Numeric values are stored in numbers. The whole number, float,


and complex qualities have a place with a Python Numbers
datatype. Python offers the type() function to determine a
variable's data type. The instance () capability is utilized to check
whether an item has a place with a specific class.

When a number is assigned to a variable, Python generates


Number objects. For instance, Python supports three kinds of
numerical data.

Int: Whole number worth can be any length, like numbers


10, 2, 29, - 20, - 150, and so on. An integer can be any length
you want in Python. Its worth hasa place with int.
Float: Float stores drifting point numbers like 1.9, 9.902, 15.2,
etc. It can be accurate to within 15 decimal places.

Complex: An intricate number contains an arranged pair, i.e., x


+ iy, where x and y signify the genuine and non-existent parts
separately. The complex numbers like 2.14j, 2.0 + 2.3j, etc.

2. Sequence Type
The sequence of characters in the quotation marks can be used
to describe thestring. A string can be defined in Python using
single, double, or triple quotes.

String dealing with Python is a direct undertaking since Python gives


worked-incapabilities and administrators to perform tasks in the
string.
When dealing with strings, the operation "hello"+" python"
returns "hellopython," and the operator + is used to combine
two strings.

Because the operation "Python" *2 returns "Python," the


operator * is referredto as a repetition operator.

3. List

Lists in Python are like arrays in C, but lists can contain data
of different types. The things put away in the rundown are
isolated with a comma (,) andencased inside square sections
To gain access to the list's data, we can use slice [:] operators.
Like how they worked with strings, the list is handled by the
concatenation operator (+) and the repetition operator (*).

[Link]

In many ways, a tuple is like a list. Tuples, like lists, also contain a
collection of items from various data types. A parenthetical space
() separates the tuple's components from one another. Because we
cannot alter the size or value of the items in a tuple, it is a read-
only data structure.

[Link]

A dictionary is a key-value pair set arranged in any order. It


stores a specific value for each key, like an associative array or
a hash table. Value is any Python object, while the key can
hold any primitive data type. The comma (,) and the curly
braces are used to separate the items in the dictionary.

[Link]

True and False are the two default values for the Boolean type.
These qualities are utilized to decide the given assertion valid or
misleading. The class book indicates this. False can be represented
by the 0 or the letter "F," while true can be represented by
any value that is not zero.

[Link]

The data type's unordered collection is Python Set. It is iterable,


mutable(can change after creation), and has remarkable
components. The elements of a set have no set order; It might
return the element's altered sequence. Either a sequence of
elements is passed through the curly braces and separated by a
comma to create the set or the built-in function set() is used to
create the set. It can contain different kinds of values.

PROGRAMS:
a) W.A.P to perform addition of two numbers by taking input from keyboard.
b) W.A.P to find area of circle
c) W.A.P to find square root of given number.
a) W.A.P to perform addition of two numbers by taking input from keyboard.

x = input("Type a number: ")


y = input("Type another number: ")

sum = int(x) + int(y)

print("The sum is: ", sum)

output:
Type a number:
Type another number:
The sum is: 15

Common questions

Powered by AI

The 'break', 'continue', and 'pass' statements provide control over the execution flow within loops. 'Break' exits the loop entirely when a specified condition is met, potentially improving efficiency by avoiding unnecessary iterations . 'Continue' skips the rest of the loop's current iteration, allowing the next iteration to proceed immediately, useful for filtering or excluding certain iterations . 'Pass' serves as a placeholder in loops and other control structures where code is syntactically required but no action is needed, aiding in maintaining code structure without functional logic .

Decision-making structures like if-elif-else in Python facilitate branching logic to handle multiple conditions. The 'if' begins the conditional check, executing the indented block if true. 'Elif''s (else-if) provide subsequent conditions, and 'else' handles any cases not previously addressed. This structure is crucial for implementing complex logic flows within programs, improving readability and control over execution pathways based on variable states and values . It enables dynamic responses to varying input, enhancing the adaptability and intelligence of Python applications .

Modules and packages in Python enhance organization and modularization of code, supporting scalable project development. Modules are single files containing Python code, whereas packages are directories containing multiple modules and an __init__.py file. They allow for logical segregation of functionalities, aiding code maintenance and collaboration by grouping related functions, classes, or variables . This structure improves namespace management and reduces the likelihood of naming conflicts, facilitating importation and usage across different parts of a project .

Functions in Python encapsulate code into reusable blocks, improving clarity and reducing redundancy. Declaring functions with def keyword allows specifying parameters, which are placeholders for input. Argument passing in functions can be positional, where values are matched to parameters based on order, or keyword-based, allowing for name-based matching. This enhances function versatility and supports default arguments for omitting optional ones . Functions thus enable modular programming, facilitating debugging and maintenance, while promoting DRY (Don’t Repeat Yourself) principles .

Tuples are immutable sequences used for storing collections of heterogeneously typed elements that are unlikely to change, allowing them to be used as keys in dictionaries . Sets are mutable, unordered collections that automatically maintain unique elements, beneficial for tasks requiring frequent membership tests or deduplication . Despite these differences, both are iterable and can be used in operations that include union and intersection, albeit with different methods of data manipulation and iteration .

Strings and lists in Python both support slicing and concatenation operations. Strings are immutable, meaning once defined, their content cannot be changed, while lists are mutable, allowing for modifications . Both utilize the '+' for concatenation and '*' as a repetition operator to output the string or list elements repeated multiple times . Despite these similarities, lists can include elements of different data types, whereas strings only include characters .

Python is strongly typed, meaning variables do not require explicit definition of their types during declaration. Each value is inherently linked to its data type, which is determined dynamically at runtime. Python's type() function can be used to identify the data type of a variable, while isinstance() checks if an object is of a specific data type . This flexibility allows for rapid development and prototyping but requires developers to be cautious about type-related errors .

You might also like