Construct a class named student consisting of a student identification number, list of five grades, and an integer representing the total value of grades entered. The constructor for this class should initialize all student data members to zero. Included in the class the functions/ methods for:
1. Constructor and a Destructor.
2. Create an assessor method to enter a student number
3. Create a method to enter a single test grade (used loop for entering 5 grades)
4. Create a mutator method – to computer an average grade
5. Create a method to display the student number and average grade.
class Student:
# Constructor
def _init_(self):
self.id_number = 0
self.grades_list = []
self.grades_total = 0
Maximum Profit
You given a list of prices where prices[i] is the price of a given stock o the i th day write a program to print the maximum profit by choosing a single day to buy a stock and choosing a different day in the future to sell that stock if these is no profit that can be achieved return 0
INPUT
The input is a single line containing space seperated integers.
OUTPUT
The output should be an integer.
Explanation
in the example the given prices are 7 1 5 3 6 4
buying stocks on day two having price 1 and selling them on the fifth day having price 6 would give the maximum profit which is 6 - 1
so the output should be 5.
sample input 1
7 1 5 3 6 4
sample output 1
5
sample input 2
1 11 13 21 19
sample output 2
20
String Concatenation
Disha has three strings A, B, and C consisting of lowercase letters.She also has a string T consisting only of characters 1, 2 and 3.
She wants to concatenate the three strings according to the characters in T.
Your task is to print the final output string.
Note: Formally, follow the below instructions:
* For each integer i such that 1<=i<=|T|, let the string si be defined as follows:
*Concatenate the strings s1,s2,...,s|T| in this order and print the resulting string.
Sample Input1
mari
to
zzo
1321
Sample Output1
marizzotomari
Number Game
A group of people are playing a game.They are standing and each carring a card with a number on it.These numbers in the list A. A random number S iis selected.
Find out the new list of numbers after
Sample Input1
1,2,3
1
Sample Output1
2 3
1 2
Word Rotation
Given a sentence and an integer N, write a program to rotate letters of the sentence among the words without changing the length of those words and positions of the spaces.
Input
The first line of input will be a sentence.
The second line of input will be an integer N.
Output
The output should be a single line containing the sentence by rotating the letters among the words without changing the length of the words and positions of the spaces.
Explanation
For example, if the given sentence and N are
Welcome to your first problem
5
Rotate the sentence 5 letters towards right side without changing the length of the words and position of spaces in the original sentence.
So the output should be
oblemWe lc omet oyour firstpr
Sample Input 1
Welcome to your first problem
5
Sample Output 1
oblemWe lc omet oyour firstpr
Sample Input 2
All the best
2
Sample Output 2
stA llt hebe
Purchase List
At a shop, a shopkeeper is making a note of all the purchases at the end of the day.He has a list full of the purchases that happened at the shop.He wants to know which item got sold only once and which item got sold more than once.Print their prices as asked.
Note:In case of ties, choose the price of the item that was sold earlier in the day.
Input
The input is a single line containing space-separated integers representing the prices of the purchases.
Output
The first line of the output contains an integer that represents the price of an item that is sold only once.
The second line of the output contains an integer that represents the price of an item that is sold more than once.
If there is no filling the given criteria, print None.
Sample Input1
5 5 4 7 4 1 11
Sample Output1
7
5
Sample Input2
1 2 3 4 5 6 7 8 9
Sample Output2
1
None
Math Quiz
Write a python program to print the following,
Sample Input 1
1 3 4 5 6
5
3 5
Sample Output1
12
String Lookup
Ram challenges Anil to a game, He decides to give a target word W to Anil.The rules of the game are very simple.Ram gives Anil N sentences one by one and asks Anil to print the first sentence which contains the given word W.If the sentence numbering starts from 1, can you identify the first sentence number containing the word W?
Note: Consider lower and upper case letters as different.
Input
The first line of input is the word W.
The second line of input is a positive integer N.
The next N lines of input contain a string in each line.
Output
The output should be a single line containing an integer.
If the given word is not in any line of input strings, print -1.
Write the Python code of a program that reads an integer, and prints the integer it is a multiple of either 2 or 5 but not both. If the number is a multiple of 2 and 5 both, then print "Multiple of 2 and 5 both