[go: nahoru, domu]

Skip to content

Collection of the Python Assignments programs of 3rd Semester NSEC

License

Notifications You must be signed in to change notification settings

5h0ov/Python-Assignment-NSEC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python-Assignment-NSEC

Collection of the Python Assignment Programs of 3rd Semester NSEC

Assignment Program Questions:

Assignment 1:

  1. Write a python program to display a message on the screen as follows. We are the students from the dept. of Information Technology. We are learning Python. It is our odd semester.
  2. Write a python program to convert a temperature in Celsius scale to its equivalent Fahrenheit scale.
  3. Write a python program to calculate the area and perimeter of a circle, a square and a rectangle. Consider all the required information is preexistent.
  4. Write a python program to find out the greatest among three integers.
  5. Write a program to swap the value of two variables using a third variable and without using a third variable.
  6. 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 andz has the value of x.
  7. Write a program to display the following numbers: 5678, 678, 78, 8, where the given number is 5678.
  8. Write a program to add two complex numbers by reading the numbers from the user.
  9. 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).
  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 python program to find out the roots of a quadratic equation and also find the type of the roots.

Assignment 2:

  1. Write a python program to find out the Fibonacci series. The series length, N will be as per user’s choice. i.e., if N=10, then the series is 0, 1, 1, 2, 3, 5, 8, 13, 21, 34.
  2. Ask for a number N from the user. Now determine whether N is a member of the Fibonacci series.
  3. Enter a digit N and further find out the sum of (N + NN + NNN), i.e., if N = 5, then sum = (5+55+555) = 615.

image

  1. Print all the factors of any given number.
  2. Find the factorial of a number entered by the user.
  3. Write a program using a while loop to print all the odd numbers within a given range.
  4. Write a program to compute the GCD and LCM of two integer numbers.
  5. Find the prime numbers for a range that will be mentioned by the User.
  6. Find the solution for the series given as (1/1! + 1/2! +1/3! + ….. + 1/N!). The value of N will be mentioned by the User.
  7. Check for any given number is Armstrong or not. Note an Armstrong number is such a number that is equal to the sum of cubes of its digits.
  8. Write a program to check whether a given number is a prime number or not.
  9. Write a program to find the sum of all prime numbers within a given range.
  10. 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.

Assignment 3:

  1. Write a program to count the number of each vowel in a sentence.
  2. Write a program to read a string and check whether the string is a palindrome or not.
  3. Write a program to get a string from a given string where all occurrences of the last character havebeen changed to ‘*’, except the last character.
  4. Write a program to count the occurrences of a word in a given sentence.
  5. Write a program to detect whether two strings are anagrams or not.
  6. Write a program to find the maximum and minimum of a list of numbers without using built-in functions.
  7. Write a program to find the union of two lists.
  8. Write a program to concatenate two lists using list comprehension.
  9. Write a program to ask the user to enter a file name with its proper extension and the system will display the file extension only.
  10. Create a list with at least 15 items and remove all duplicate items from that list.
  11. Add the item 7000 after 6000 in the following Python List. Given List: [10, 20, [300, 400, [5000, 6000], 500], 30, 40]
  12. Extend a given nested list by adding the sub list ["h", "i", "j"] in such a way that it will look like the following expected list. Given_List: ["a", "b", ["c", ["d", "e", ["f", "g"], "k"], "l"], "m", "n"] Expected_List: ['a', 'b', ['c', ['d', 'e', ['f', 'g', 'h', 'i', 'j'], 'k'], 'l'], 'm', 'n']
  13. Write a program to multiply two matrices as nested lists.
  14. Write a program to create a list from two given lists ‘list1’ and ‘list2’ of numbers such that it containsnumbers that are present in ‘list2’ but not in ‘list1’.
  15. Write a program to find the distinct pair of numbers whose product is odd from a list of integers.
  16. Write a python program that will input the following information and store those in a tuple and then print the entered information.
  • Empno (int),
  • Name (str),
  • Salary (float)
  1. Create two sets of 10 arbitrary Natural numbers and 10 arbitrary Real numbers each. Find out the common numbers from these two sets.
  2. Write a program to accept a sequence of comma-separated numbers from the user and generate a tuplewith those numbers.
  3. Write a program to add elements in a tuple without using built-in functions.
  4. Write a program to calculate the mean of elements in a tuple of integers.
  5. Write a program to display unique and duplicate elements of a tuple.
  6. Write a program to count the frequency of all the elements in a tuple.
  7. Write a program to find the distinct pair of numbers whose product is even from a tuple of integers.

Assignment 4:

  1. Create two sets of 10 arbitrary Natural numbers and 10 arbitrary Real numbers each. Find out the common numbers from these two sets.

  2. Create two sets of students with 10 members each for Cultural committee and Sports committee. Find out those students who are not common in these two committees.

  3. Create a new dictionary by extracting the following keys from the dictionary given below. sampleDict = { "name": "Kelly", "age":25, "salary": 8000, "city": "New york"} Keys to extract, keys = ["name", "salary"]

  4. There are two lists given below. Convert those into a single dictionary as {keys : values}. keys = ['Ten', 'Twenty', 'Thirty', ‘Forty’, ‘Fifty’] values = [10, 20, 30]

  5. Write a Python program which can accept the Names of players and Runs-scored by them in a cricket team. Use dictionary to store these details. Finally print the run scored against a player’s name that will be entered. Show a suitable message if a player is not found.

  6. Enter the marks scored by a student in an examination for the subjects as mentioned in the dictionary, “marksDict”. Find the subjects and marks where the student has scored the best and the worst. marksDict = { ‘English’: ? , 'Physics': ? , 'Math': ? , ‘Chemistry’: ? , 'history': ? }

  7. 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).

  8. Write a program to count the numbers of characters in a string and store them in a dictionary.

  9. 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.

  10. Write a program to sort (in ascending order) a dictionary by value.

  11. Write a program to merge two dictionaries.

  12. Write a program to find GCD and LCM of two numbers by defining a function to compute GCD and LCM.

  13. Write a program to define a function that accepts a string and calculates the number of uppercase letters and lowercase letters.

  14. Write a program to find all the unique elements of a list by defining a function.

  15. Write a program to print the even numbers from a given list using the lambda function

  16. Write a program to find the maximum value from a list using the lambda function.

  17. Write Python function(s) that take(s) two lists from the user and return(s) the common items from both lists. Thereafter merge those two lists into a separate empty list where there will no duplicate items.

  18. Write Python function(s) to convert a Hexadecimal number to its equivalent Binary and Decimal values.

  19. Find out the factorial of a given number using a recursive function.

  20. Write a program to find all the numbers divisible by 5 and 7 between the given range using the Lambda function.

  21. Create a sequence of 30 integers (you may use range() for it). Reduce this sequence to even numbers only and store their inverse into another sequence by using filter() and map(). Finally find out the sum of all elements in the reduced sequence. You can use reduce().

About

Collection of the Python Assignments programs of 3rd Semester NSEC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages