Python Code challenge
1. XYZ company has approached a bank for a loan of 1000000$ for 5 years at 9% interest / per
month. Calculate the monthly loan instalment.
Formula to calculate the monthly loan instalment is
LP = (pv*i) / (1 - (1+i)^-n)
pv: loan amount (present value)
i = Interest (in decimals)
n = time period (in months)
LP = loan payment
2. Write a program to find a minimum number from an array?
3. Given an array a=[1,2,3,4,5], write a program to get values of array 'a' as key elements and
index of elements in array as values in the dictionary.
4. How to get odd and even numbers from a given list
5. how to get multiple of any numbers from list
6. Write a program to swap two variables without using the third variable.
7. user gives the input suppose we give the input 1 and it wants to print the letter 'ONE'
8. Write a program to print Armstrong Numbers.
10. Write a program to find a non overlapping substrings of a string
11. (Write a program) which takes a sequence of numbers and check if all numbers are unique.
12. Write a program for counting the number of every character of a given text file.
13. Write a Program to add two integers >0 without using the plus operator.
14. Write a Python program to check whether an accepted number is prime number.
15. Write a program to print Fibonacci series.
16. Write a program to check whether the entered number is palindrome.
17. Write a Python program to check if two strings are anagram.
18. Create 2 lists of random 1,2 and 3 digit integers. (both lists need not have the same number
of integers).
Multiply every 1-digit number of L1 with every 1-digit number of L2.
Multiply every 2-digit number of L1 with every 2-digit number of L2.
Multiply every 3-digit number of L1 with every 3-digit number of L2.
19. Given a number, convert this into the Indian currency format.
Eg: if number is 11567, convert to 11,567
Number 7815 → 7,815
Etc..
20. Create a tuple of grocery shopping items (take 5-6 items). The format is
Item_name (random values)
Qty (random)
Rate (random)
Total_price
i) Calculate the Total_price of each item as Qty * Rate
ii) Calculate the Total Bill Amount
iii) Find the expensive and cheapest item from the bill (based on total_price)
21. A confusion matrix is a mxm matrix to display the performance of a classification problem.
Write a python program to simulate a 2x2 confusion matrix.
The output should be in the following format
Predicted +ve Predicted -ve Actual Total
Actual +ve 30 9 39
Actual -ve 6 55 61
Predicted Total 36 64 100
• Create a random dataset of 100 samples with data as given above in the confusion
matrix