-
RTO List
RTO is the place where the new bikes and cars are registered but they have a limitation like, they have to register only m number of vehicles per day. So if there are any vehicles more than that, they'll be sent back asking to come back tomorrow. So write a program to display the number of vehicles registered with all the details regarding vehicles and help them get all the details of the day in on single sheet.
Input Format
Input will contain two integers.
The First corresponds to number of vehicals for registration.
The second Input corresponds to maximum number of vehicals that can be registered in one day
And all the details of the vehicle.
Output Format
The output contains a list of details of all the vehicles registered one after the other.
Sample Input
4 10
KA09MN01
51178964525
258795462
Chandan V
Mysore
KA09MN02
51178964525
258795462
Chandru V
Mysore
KA09MN03
51178964525
258795462
Chandini V
Mysore
KA09MN04
51178964525
258795462
Chandana A
Mysore
Sample Output
Reg.no chassis no engine no owner name address KA09MN01 51178964525 258795462 Chandan V Mysore KA09MN02 51178964525 258795462 Chandru V Mysore KA09MN03 51178964525 258795462 Chandini V Mysore KA09MN04 51178964525 258795462 Chandana A Mysore -
Second Largest Number – Union Set
Prakash having N number of sets. Prakash wants to find the second-largest number. So first he wanted to find the union of all sets and then he returns the second largest number of the union sets. So can u please help to write a program to find the second largest number of union set? Input and output format specifications are shown below.
Input Format
The first line of input consists of several sets you required.
The second-line consists of entering the inputs to the sets.
Output Format
The first line of output contains the Union of all sets.
The second line of output contains the Second largest Number of Union sets.
Sample Input
3
1,1
2,1
4,5
Sample Output
set([1, 2, 4, 5])
4
-
Symmetric_Difference
Gokul have two different sets and he wants to find the Symmetric_Difference between two sets. The symmetric difference of two sets A and B is the set of elements that are in either of the sets A or B but not in both. So can u please help to write a program to find the symmetric_Difference between two sets? Input and Output format will be shown below.
Input Format
Firstline contains to enter the elements to set1(integers).
Second-line contains to enter the elements to set2(integers).
Output Format
Output Consists of Symmetric_difference between set1 and set2 (Integers)
If both set elements are equal to print ‘invalid set’.
Sample Input1
1 2 3 4 5 6
2 3 5 7 8 9
Sample Output1
1 4 6 7 8 9
Sample Input2
1 2 3
1 2 3
Sample Output2
Invalid set
-
Different Operations In-Sets
Sumanth having N number of elements and he decided to create a set for it. And after creating set he wants to add some elements to set and remove elements to set and find the difference between two sets, and he wants to know the intersection elements in two sets. And all the process will be shown in input and output format specifications. So can you please help him to write a program to add(),remove(),intersection(),difference() to the sets.
Input Format
The first line of input creates set 1 with Strings.
The second line of input creates set 2 with Strings.
The next line will choose one option in which operation you want in sets.
Next line will be choose set for operation
Output Format
The output consists of a single line as per your choice.
Display 'invalid choice', if the entered choice is wrong.
Sample Input1
banana,apple,sony
mango,apple,samsung
choose one option 1)add 2)remove 3)difference 4)intersection
1
choose one 1)set1 2)set2
1
orange
Sample Output1
set(['apple','banana',orange','sony',])
Sample Input2
banana,apple,sony
mango,apple,samsung
choose one option 1)add 2)remove 3)difference 4)intersection
2
choose one 1)set1 2)set2
1
apple
Sample Output2
set(['banana','sony'])
-
K-elements sum in the Set
Raj wants to generate some random numbers for creating a new PIN for his debit card, every month. So he developed Program such a way that, he will enter list random numbers which are having duplicate elements and it will return a set of distinct elements from that, he will generate a new PIN for his card.
Input Format
So the program will take list elements, which are having duplicate elements, and create a set of distinct elements, and sum the k elements every time. and generate the new set, which will have summed values. if the subset is not having k elements it will not sum the remaining values, it will directly add remaining elements to the new set.
So let us try to write a program to get a set of elements from the given list of elements.
1st input is a number indicates a total number of elements in the list.
2nd input is a String contains a list of numbers.
3rd input is number indicates K (number of elements need to sum every time)
Output Format
The output contains a set of elements after summing.
Sample Input
9
1 3 2 4 5 1 6 31 15
3
Sample Output
[6, 15, 31]
-
Swapped Balls
There was 'n' number of numbered balls are there, Pankaj has to swap the first and last ball. Help Pankaj to do this swapping task on the list.
Input Format
In this program, enter the 'n' elements in the list, and swap the first and last element of the list, print the original list as well as a swapped list.
First line consists of an interger n
Second line consists of 'n' integers which are separated by spaces.
Output Format
The output consists of a list of integer elements, in which 1st and last element were swapped.
Sample Input
5
13 7 2 21 5
Sample Output
5 7 2 21 13