Skip to content

These are some Python programs which I have written in my university practical classes. Hope you will get some benefit.

Notifications You must be signed in to change notification settings

abhrajit2004/Python-Lab-Assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2nd Year 3rd Semester

Name of the Course: IT Workshop(Python)

Course Code: PCC-CS393

  1. Write a program to convert temperature from degree Celsius to degree Fahrenheit.
  2. Write a program to calculate the area and perimeter of a rectangle.
  3. Write a program to swap the value of two variables using a third variable and without using a third variable.
  4. Write a program to swap two numbers using bitwise operators.
  5. Write a program to rotate the value of x, y, and z such that x has the value of y, y has the value of z and z has the value of x.
  6. Write a program to display the following numbers: 5678, 678, 78, 8, where the given number is 5678.
  7. Write a program to add two complex numbers by reading the numbers from the user.
  8. Write a program to accept the principal amount, rate of interest, and duration from the user. Calculate the interest amount and the total amount (principal + interest).
  9. Write a program to sort three numbers using if-elif-else.
  10. Write a program to calculate simple interest with the following conditions:
    • If the principal amount is less than 2,00,000 the interest rate is 10%.
    • If the principal amount is 2,00,000 -10,00,000 the interest rate is 12%.
    • If the principal amount is greater than 10,00,000 the interest rate is 15%.
  11. Write a program to print the following patterns:
    1
    2, 3
    4, 5, 6
    7, 8, 9, 10
    11, 12, 13, 14, 15

    Screenshot 2024-02-03 165426
  12. Write a program using a while loop to print all the odd numbers within a given range.
  13. Write a program to compute the GCD of two integer numbers.
  14. Write a program to print the decimal equivalents of 1/2, 1/3, 1/4,. ........................... , 1/10 using for loop.
  15. Write a program to check whether a given number is a prime number or not.
  16. Write a program to check whether a given number is an Armstrong number or not.
  17. Write a program to get the LCM of two positive integers.
  18. Write a program to find the sum of all prime numbers within a given range.
  19. Write a program that prompts users to enter numbers. This process repeats until the user enters -1. Finally, the program prints the count of prime and composite numbers entered.
  20. Write a program to find the sum of the even-valued terms of the Fibonacci series up to 100.
  21. Write a program to count the number of each vowel in a sentence.
  22. Write a program to read a string and check whether the string is a palindrome or not.
  23. Write a program to get a string from a given string where all occurrences of the last character have been changed to ‘*’, except the last character.
  24. Write a program to count the occurrences of a word in a given sentence.
  25. Write a program to get all substrings of a given string.
  26. Write a program to detect whether two strings are anagrams or not.
  27. Write a program to find the maximum and minimum of a list of numbers without using built-in functions.
  28. Write a program to multiply two matrices as nested lists.
  29. Write a program to find the union of two lists.
  30. Write a program to concatenate two lists using list comprehension.
  31. Write a program to create a list from two given lists ‘list1’ and ‘list2’ of numbers such that it contains numbers that are present in ‘list2’ but not in ‘list1’.
  32. Write a program to find the distinct pair of numbers whose product is odd from a list of integers.
  33. Write a program to accept a sequence of comma-separated numbers from the user and generate a tuple with those numbers.
  34. Write a program to add elements in a tuple without using built-in functions.
  35. Write a program to calculate the mean of elements in a tuple of integers.
  36. Write a program to display unique and duplicate elements of a tuple.
  37. Write a program to count the frequency of all the elements in a tuple.
  38. Write a program to find the distinct pair of numbers whose product is even from a tuple of integers.
  39. Write a program to create a dictionary that contains (i, i*i) such that i is an integral number between 1 and n (both included).
  40. Write a program to count the numbers of characters in a string and store them in a dictionary.
  41. Write a program to create a dictionary by combining two lists ‘name’ for employee name and ‘salary’ for employee salary. Use the list ‘name’ as the key and ‘salary’ as the value of dictionary elements.
  42. Write a program to input player's name (string) and runs (integer) scored for n number of players where n should be input from the keyboard. Store the player’s details in a dictionary called 'cricket'. After preparing the dictionary, input the player's name and print the runs scored by the player otherwise returns'-1' if the player's name is not found.
  43. Write a program to sort (ascending order) a dictionary by value.
  44. Write a program to merge two dictionaries.

About

These are some Python programs which I have written in my university practical classes. Hope you will get some benefit.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages