A super market plans to conduct a surprise cum lucky winner contest in a different way. The super market sells different vegetables and fruits to customers. Write a python program to accept the items purchased by number of customers under each category [Vegetables and Fruits] with their quantity (in kg) and display the total quantity of items sold under each category. Find out the common item(s) in the shopping basket of the customers. The customer, who buys the highest quantity of common item(s), will be the lucky winner and display the lucky winner customer number.
Write a simple python program to print and add number starting 1 onward till the sum of them is less than 100
#the required output is as the n positive number having the total sum less than 100 are .
1 2 3 4 5 6 7 8 9 10 11 12 13 sum of the numbers =91
Design an algorithm and write the python program to determine the bonous amount he will receive as a dictionary in sorted order and then the total expenditure for the enterprise use pprint function for printing dictionary in sorted order
Write a python program to take the number of lines as input and print the following patterns
Input
Enter the number of lines
4
Output
1
2 4 2
1 3 5 3 1
2 4 6 8 6 4 2
1 3 5 3 1
2 4 2
1
Write a python program to accept the date of joining of service of n employees in an IT firm and count the number of employees whose number of years of service falls in the following year groups considering the following HR Policy of the firm. [Note: Consider the current date as 2021-11-30]
i) <2 ii) 2-7 iii) 8-19 iv) 20-32 v) >32
Ø If the number of years of service is less than 2 years, then consider them [Associate Software Engineer] working under the Probation period.
Ø If the number of years of service is in the range of 2-7 years, then consider them [Software Engineer] working as a permanent employee.
Ø If the number of years of service is in the range of 8-19 years, then consider them [Team Leader] working as a senior employee.
Ø If the number of years of service is in the range of 20-32 years, then consider them [Project Manager] as an executive employee.
Ø If the number of years of service is more than 32 years, then consider them as a Retired employee.
The following are the required components of this assignment:
1. Consider the loop from Section 8.3 of your textbook.
prefixes = 'JKLMNOPQ'
suffix = 'ack'
for letter in prefixes:
print(letter + suffix)
Put this code into a Python script and run it. Notice that it prints the names "Oack" and "Qack".
Modify the program so that it prints "Ouack" and "Quack" but leaves the other names the same.
Include the modified Python code and the output
2. Give at least three examples that show different features of string slices. Describe the feature illustrated by each example.
Taking some samples of DNA from patients, lets computers collect and extract important information that can be found in the DNA sequence. In this scenario, you will serve as an intern in laboratory who will be assigned an important task. You will be given a long DNA sequence, which is represented in a string of letters. Your task is to convert 3-letter codons into protein residues. The output would be the corresponding residues.
INPUT: DNA sequence
OUTPUT: Generated 3-letter codons and corresponding protein residues
An input sample of DNA sequence would look like this:
TGGTACTCTTTCTTCACAAGGGCGCCGTGTGTG
The 3-letter codons are simply every three letters in the sequence.
TGG TAC TCT TTC TTC ACA AGG GCG CCG TGT GT
Equivalent mapping will be: WYSFFTRAPC*
Note: The sequence might not have a multiple of 3 bases. If that happens you must map the final 1- or 2-base term to asterisk, instead.
Construct an algorithm and write a python to create a regular expression to retrieve marks and names from a given string or files. Extract only marks having 2 digits and names starting with capital letter. A word is called as a good word if all the letters of the word are distinct. That is, all the letters of the word are different from each other letter. Else, the word is called as a bad word. Write an algorithm and the subsequent Python code to check if the given word is good or bad.: e.g. START, GOOD, BETTER are bad: WRONG is good! Make the comparison to be case insensitive.