Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Database engineers

The document is a practical file for a Bachelor of Computer Application course at Vivekananda Institute of Professional Studies, focusing on Python programming assignments. It includes a series of assignments that require writing Python functions for various tasks such as finding maximum numbers, calculating factorials, checking prime numbers, and manipulating lists and dictionaries. Each assignment specifies the required code and expected output, demonstrating practical applications of Python programming concepts.

Uploaded by

hrishabhjoshi123
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Database engineers

The document is a practical file for a Bachelor of Computer Application course at Vivekananda Institute of Professional Studies, focusing on Python programming assignments. It includes a series of assignments that require writing Python functions for various tasks such as finding maximum numbers, calculating factorials, checking prime numbers, and manipulating lists and dictionaries. Each assignment specifies the required code and expected output, demonstrating practical applications of Python programming concepts.

Uploaded by

hrishabhjoshi123
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

VIVEKANANDA INSTITUTE OF PROFFESSIONAL STUDIES

VIVEKANANDA SCHOOL OF INFORMATION TECHNOLOGY

BACHELOR OF COMPUTER APPLICATION


Practical file – Basics of Python
BCA - 211
Programming

Guru Gobind Singh Indraprastha University


Sector - 16c, Dwarka, Delhi-110078

Submitted to: Submitted by:


Dr. Neetu Goel Hrishabh Joshi
Associate Professor 3EA
VSIT 03929802023
SR Assignment Date Signature
no.
1 Assignment - 1

2 Assignment - 2

3 Assignment – 3

4 Assignment – 4

5 Assignment – 5

6 Assignment – 6

7 Assignment – 7
Assignment 5

1. Write a Python function to find out the maximum of three numbers.


Code and output:

2. Write a Python recursive/non-recursive function to calculate the factorial of a


number (a non-negative integer). The function accepts the number as an
argument.
Code and output:
By recursion

By iteration
3. Write a Python function to check whether a number falls in a given range.
Code and output:

4. Write a Python function that accepts a string and find out how many characters
are in upper case letters and lower case.
Code and output:

5. Write a Python function that takes a number as a parameter and checks the
number is prime or not.
Code and output:
6. Write a Python function that takes a number as an argument and displays all
prime numbers up to nth number.
Code and output:

7. Write a Python function to generate the Fibonacci series up to nth number.


Code and output:
8. Write a Python function sum (start, end) that adds all the integers between the
start and end value (inclusive) and returns the total sum.
Code and output:

9. Write a Python program to check the divisibility of a number by 7 that is


passed as a parameter to the user defined function.
Code and output:

10. ABC store plans to give festival discounts to its customers. The store
management has decided to give discount on the following criteria:
Shopping Amount Discount Offered
>=500 and <1000 5%
>=1000 and <2000 10%
>=2000 15%
Write a program to generate the bill of ABC Store.
Code and output:
11. An additional discount of 5% is given to customers who are the members of
the store. Create a program using user defined function that accepts the shopping
amount as a parameter and calculates discount and net amount payable on the
basis of the following conditions:
Net Payable Amount = Total Shopping Amount – Discount.
Code and output:
12. Write a Python program that uses a user defined function that accepts name
and gender (as M for Male, F for Female) and prefixes Mr. /Ms. on the basis of
the gender.
Code and output:

13. Write a Python program that has a user defined function to accept the
coefficients of a quadratic equation in variables and calculates its determinant.
For example : if the coefficients are stored in the variables a, b ,c then calculate
the determinant as b2-4ac. Write the appropriate condition to check determinants
on positive, zero and negative and output appropriate results.
Code and output:
14. ABC School has allotted unique token IDs from (1 to 600) to all the parents
for facilitating a lucky draw on the day of their Annual day function. The winner
would receive a special prize. Write a program using Python that helps to
automate the task.(Hint: use random module)
Code and output:

15. Write a Python program that creates a Python quiz consisting of any five
questions of your choice. The questions should be displayed randomly. Create a
user defined function score() to calculate the score of the quiz and another user
defined function remark (scoreValue) that accepts the final score to display
remarks as follows:
Marks Remarks
5 Outstanding
4 Excellent
3 Good
2 Read more to score more
1 Needs to take interest
0 General knowledge will always help you. Take it seriously.
Code and output:
16. Write a Python pr ogram to calculate sum of first ‘n’ natural numbers using
recursion.
Code and output:
17. Write a Python program to input two numbers from user variable x and y and
performed recursive function to find out the value of xy.
Code and output:
Assignment 6
1. Write a Python program to accept the values from the user and append into the
list.
Code and Output

2. Write a Python program to swap two elements in a list.


Code and Output

3. Write a Python program to count the number of strings where the string length
is 2 or more and the first and last character are same from a given list of strings.
Code and Output
4. Write a Python program to find out the sum of all elements in list.
Code and Output

5. Write a Python program to display the second largest number in a list.


Code and Output

6. Accept 10 numbers from the user and store them in the list. Write a Python
program to create two lists – the first list containing all even numbers and the
second list containing all odd numbers.
Code and Output
7. Accept 10 numbers from the user and store them in the list. Write a Python
program to remove all duplicates from the list.
Code and Output
8. Accept a list containing 10 strings from the user. Write a Python program to
convert all these strings to uppercase.
Code and Output

9. Accept 5 numbers from the user and store them in a list. Write a program to
turn every item of a list into its square.
Code and Output

10. Write a function that checks whether two words are anagrams. Two words are
anagrams if they contain the same letters. For example, silent and listen are
anagrams. Hint: Obtain two lists for the two strings. Sort the lists and check if
two lists are identical. Write a test program that prompts the user to enter two
strings and, if they are anagrams, displays “it is an anagram”; otherwise displays
“it is not an anagram”.
Code and Output

11. Write a Python program to remove all occurrences of particular item in the
existing list.
Code and Output
Assignment 7
1. Write a Python program to get the maximum and minimum value in a
dictionary
Code and Output:

2. Write a Python program to sum all the items in a dictionary


Code and Output:

3. Write a Python program to merge two Python dictionaries.


Code and Output:

4. Write a Python program to generate and print a dictionary that contains all
even numbers (between 1 and n) in the form (x, x^3).
Code and Output:

5. Write a Python program to remove a key from a dictionary.


Code and Output:

6. Write a Python program to remove duplicates from Dictionary.


Code and Output:

7. Write a Python program to combine two dictionaries adding values for


common keys (for example :
d1={1: 10, 2: 20, 3: 30,5:10}
d2={4: 40, 5: 50, 6: 60,2:10}
output : {1:10, 2:30, 3:30, 4:40, 5:60, 6:60}
Code and Output:

8. write a python program to find out the key based on the value
Code and Output:

9. write a python program for dictionary of names of students and a list of their
marks in 4 subjects. create another dictionary from this dictionary that has name
of the students and their total marks. find out the topper and his/her marks.
Code and Output:
10. write a python program to reverse the dictionary values.
Code and Output:

11. Write a python program to accept a string from user, to find the frequency of
each character with the help of dictionary.
Code and Output:
12. Write a python program to accept a string from user, to find the frequency of
each word with the help of dictionary.
Code and Output:

13. Python program to find the Sum of all even elements in the existing tuple
Code and Output:

14. Python program to accept two tuples from the user and display all
combinations of all elements in the form of tuple
Code and Output:
15. Python program to find a particular element that exists or not; if exists then
delete an element from the given tuple.
Code and Output:

You might also like