Test yourself -1



Hello Folks....!!!! Today we are not going to see any content. I will post some exercises, try them and test yourself. Let me know if you have some doubts while executing these exercises: 

The exercises will be based on the contents posted from the beginning till yesterday.


1.  Try a simple calculator. Get input from user and assign it to two separate variables. Have separate variables to store the answer for each operation. Print them as output. Perform the following operations : addition, subtraction, multiplication, modulo, division, exponential (use the operator **, eg: a**b)


2. Ram and Hari are friends. They have just got their exam results. Create two list namely Ram and Hari. Get their marks in 5 subjects as input and append in their respective lists. Calculate the total marks using appropriate built in function, with that calculate the average also. Display the highest and least marks scored by Hari. (Note : try to get the inputs separated by space in single line for each of them. eg: for Ram, give input as "56 78 90 87 67". Similarly for Hari.)

3. There are 3 cities given along with the Temperature recorded for past 5 days in that city. What you have to do is, the inputs will be three lists, remove the name of the city using appropriate built-in method from the list, calculate the average temperature of each city and add it to a new list. From that list display the maximum average temperature. (Average is nothing but total/no.of.items). The input lists are:
  • T=['Trichy',28,24,30,26,31]
  • C=['Chennai',30,31,28,26,25]
  • M=['Madurai',21,23,25,22,30]

4
(kind of placement problem-simplified version) Consider an array with some integers. Divide the array such that the sum of resulting two arrays are equal. ( If you are asked to operate with arrays in placements, you have to use lists in python). For example : array=[5,6,2,1,7,3,4]. It can be spliced as [5,6,2,1] and [7,3,4] where the sum is equal to 14 for both of them. Use appropriate built in methods, display the two arrays after splicing and the sum you got. Try for the input arrays :

  1. [5,10,2,1,10,2]
  2. [5,2,6,4,1,1,11,2]

    5. consider the list: fruits =['apple','orange','mango','grapes','apple','orange','mango','apple','orange','orange','apple','apple','mango','apple','mango','grapes','mango','grapes','mango','orange','mango','orange','mango','grapes','grapes','orange']
    display the count of each fruit using appropriate in-built method.


    Please do try all these questions. If you get any doubts or if you get any error which you couldn't figure out, please post them in the comment section so that whoever is getting same error can also get it cleared. You can ask me your doubts through mail also. Mail your doubts to crazygirlaks@gmail.com.


    solution👉

    Comments