Collection of the Python Assignment Programs of 3rd Semester NSEC
- 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.
- Write a python program to convert a temperature in Celsius scale to its equivalent Fahrenheit scale.
- 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.
- Write a python program to find out the greatest among three integers.
- Write a program to swap the value of two variables using a third variable and without using a third variable.
- 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.
- Write a program to display the following numbers: 5678, 678, 78, 8, where the given number is 5678.
- Write a program to add two complex numbers by reading the numbers from the user.
- 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).
- 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%
- Write a python program to find out the roots of a quadratic equation and also find the type of the roots.
- 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.
- Ask for a number N from the user. Now determine whether N is a member of the Fibonacci series.
- 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.
- Print all the factors of any given number.
- Find the factorial of a number entered by the user.
- Write a program using a while loop to print all the odd numbers within a given range.
- Write a program to compute the GCD and LCM of two integer numbers.
- Find the prime numbers for a range that will be mentioned by the User.
- 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.
- 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.
- Write a program to check whether a given number is a prime number or not.
- Write a program to find the sum of all prime numbers within a given range.
- 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.
- Write a program to count the number of each vowel in a sentence.
- Write a program to read a string and check whether the string is a palindrome or not.
- 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.
- Write a program to count the occurrences of a word in a given sentence.
- Write a program to detect whether two strings are anagrams or not.
- Write a program to find the maximum and minimum of a list of numbers without using built-in functions.
- Write a program to find the union of two lists.
- Write a program to concatenate two lists using list comprehension.
- 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.
- Create a list with at least 15 items and remove all duplicate items from that list.
- Add the item 7000 after 6000 in the following Python List. Given List: [10, 20, [300, 400, [5000, 6000], 500], 30, 40]
- 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']
- Write a program to multiply two matrices as nested lists.
- 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’.
- Write a program to find the distinct pair of numbers whose product is odd from a list of integers.
- 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)
- Create two sets of 10 arbitrary Natural numbers and 10 arbitrary Real numbers each. Find out the common numbers from these two sets.
- Write a program to accept a sequence of comma-separated numbers from the user and generate a tuplewith those numbers.
- Write a program to add elements in a tuple without using built-in functions.
- Write a program to calculate the mean of elements in a tuple of integers.
- Write a program to display unique and duplicate elements of a tuple.
- Write a program to count the frequency of all the elements in a tuple.
- Write a program to find the distinct pair of numbers whose product is even from a tuple of integers.
-
Create two sets of 10 arbitrary Natural numbers and 10 arbitrary Real numbers each. Find out the common numbers from these two sets.
-
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.
-
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"]
-
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]
-
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.
-
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': ? }
-
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).
-
Write a program to count the numbers of characters in a string and store them in a dictionary.
-
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.
-
Write a program to sort (in ascending order) a dictionary by value.
-
Write a program to merge two dictionaries.
-
Write a program to find GCD and LCM of two numbers by defining a function to compute GCD and LCM.
-
Write a program to define a function that accepts a string and calculates the number of uppercase letters and lowercase letters.
-
Write a program to find all the unique elements of a list by defining a function.
-
Write a program to print the even numbers from a given list using the lambda function
-
Write a program to find the maximum value from a list using the lambda function.
-
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.
-
Write Python function(s) to convert a Hexadecimal number to its equivalent Binary and Decimal values.
-
Find out the factorial of a given number using a recursive function.
-
Write a program to find all the numbers divisible by 5 and 7 between the given range using the Lambda function.
-
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().