0% found this document useful (0 votes)
5 views3 pages

Python Unit 1 Practical Assignment

This document outlines a practical assignment for a Python programming course, detailing various tasks for students to complete. The tasks include printing messages, demonstrating data types, manipulating strings, lists, dictionaries, and tuples, as well as performing arithmetic and logical operations. Additionally, students are required to implement string functions, user input handling, and various conversions.

Uploaded by

harsh02445
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)
5 views3 pages

Python Unit 1 Practical Assignment

This document outlines a practical assignment for a Python programming course, detailing various tasks for students to complete. The tasks include printing messages, demonstrating data types, manipulating strings, lists, dictionaries, and tuples, as well as performing arithmetic and logical operations. Additionally, students are required to implement string functions, user input handling, and various conversions.

Uploaded by

harsh02445
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

GLS UNIVERSITY

FACULTY OF COMPUTER APPLICATIONS & INFORMATION TECHNOLOGY


242301402 Python Programming - Practicals
BCA (Dual Specialization)
Sem – IV
Practical Assignment – I

1. Print a Hello message on interactive screen.


2. Create a Python program to demonstrate the use of comments(single and multi-line).
3. Create a Python program that will have 3 variables which stores integer, float and
complex value. Display its value and also demonstrate its datatype class using type().
4. Create a Python program that will have one string variable =“Welcome to Python”.
Perform following operations:
• Print whole string
• Print only first character of string
• Print 3rdcharacter to -1 character of string using slicing operator
• Print string from 4thcharacter to the end of string using slicing operator
• Print whole string 5 times using appropriate operator.
5. Create a Python program that will have one list with values = [‘Navratri’, ‘Diwali’,
‘Holi’, ‘Rakshabandhan’,’Bakri Id’, ‘Muharram’ ]. Perform following operations:
• Print whole list
• Print only first element of list
• Prints elements starting from 2nd till 3rd
• Prints elements starting from 2ndelement till last
• Print whole list 4 times using appropriate operator.
6. Create a Python program that will have one fruit dictionary with fruit values. Display
keys and values separately.
7. Create a Python program that will have one tuple of vegetables with values = (‘Potato’,
‘Brinjal’,‘Tomato’,‘Cabbage’, ‘Cauliflower’). Perform following operations:
• Print whole tuple
• Print only first element of tuple
• Prints elements starting from 2ndtill4th
• Prints elements starting from 2ndelement till last
• Print whole tuple twice using appropriate operator.
8. Write a Python program that will demonstrate the use of Sting Functions.
9. Write a Python program that will display numbers from 1 to 20(both inclusive) using
range()function.
10. Write a Python program to calculate the area of rectangle and square.
11. Write a Python program to swap of two numbers.
12. Write a Python program to calculate the sum of 5 subject and find the percentage.
13. Write a Python program to find length of string.
14. Write a Python program that will perform following conversions using appropriate
method:
1. string to integer
2. integer to float
3. tuple to list
4. string to list
5. list to tuple
15. Write a Python program that will demonstrate the use of Arithmetic Operators.
16. Write a Python program that will demonstrate the use of Comparison Operators.
17. Write a Python program that will demonstrate the use of Bit wise Operators.
18. Write a Python program that will demonstrate the use of Assignment Operators.
19. Write a Python program that will demonstrate the use of Logical Operators.
20. Write a Python program that will demonstrate the use of Identity Operators.
21. Write a Python program that will demonstrate the use of Membership Operators.
22. Write a Python program which have string str = “Hello World”,count how many times ‘l’
is repeated in str using count()function.
23. Write a Python program which asks the user to input a string. Convert that string into
opposite case than inputted by user. F o r e x a m p l e : s t r = “ P y t H o n ” t h a n
output = “pYThON”
24. Write a Python program which asks the user to input a string. Convert that string into
title case.
25. Write a Python program which asks the user to input a string. Find the sub-string in given
string. (Hint: Welcome in GLS University, Find the position of ‘Uni’ from given string)
26. Write a Python program which asks the user to input a string and perform lstrip and rstrip
function on input string.
27. Write a Python program which asks the user to input a string. Perform the following
operations:
 Slicing operation
 Concatenate by using + and , operator
28. Write a Python program which asks the user to input a string. Use endswith and startwith
operations on input string.
29. Write a program to accept a filename from the user print the extension of that.
30. Write a program to convert the temperature from degree centigrade to Fahrenheit.
[C = ((F-32)*5)/9]
31. Write a program to calculate the sum of 5 subject and find the percentage.
32. Write a program to get the Python version.
33. Write a program to display reverse the string.
34. Write a program to display alternate character in string.
35. Write a program to display last five characters of string.
36. Write a program to display first Five characters
37. Write a program to display middle character of string.
38. Write a program to display whether string has only digits or only alphabets.
39. Write a program to display whether string contains only space or not.
40. Write a program to check entered string is palindrome or not.
41. Write a Python program to replace a substring within a string with another substring.
42. Write a Python program to merge two lists into a single list.
43. Write a Python program to convert all characters in a string to uppercase.
44. Write a Python program that accepts a string and counts the number of words in the string.
45. Write a Python program to convert a string to lowercase.
46. Write a Python program to join a list of strings into a single string (use join() method).
47. Write a Python program to split a string into a list of words (use split()).
48. Write a Python program to find the index of the first occurrence of a specific character in a
string.

You might also like