This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # PF-Assgn-39 | |
| # This verification is based on string match. | |
| '''A vendor at a food court is in the process of automating his order management system. | |
| The vendor serves the following menu – Veg Roll, Noodles, Fried Rice and Soup and also maintains the quantity available for each | |
| item. The customer can order any combination of items. The customer is provided the item if the requested quantity of item is | |
| available with the vendor. | |
| Write a python program which implements the following functions. | |
| place_order(*item_tuple): This function accepts the order placed by the customer. Consider it to be a variable length argument | |
| as each customer may have a different order. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PF-Assgn-38 | |
| def check_double(number): | |
| num1=str(number*2) | |
| number=str(number) | |
| count=0 | |
| for x in number: | |
| if x in num1: | |
| count+=1 | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PF-Assgn-36 | |
| #Sample Input Expected Output | |
| #23,34,55 553423 | |
| def create_largest_number(number_list): | |
| num="" | |
| number_list=sorted(number_list) | |
| for x in range(-1,-len(number_list)-1,-1): | |
| num+=str(number_list[x]) | |
| return int(num) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PF-Assgn-35 | |
| #find_more_than_average(): Find and return the percentage of students who have scored more than the average mark of the class. | |
| #generate_frequency(): Find how many students have scored the same marks. For example, how many have scored 0, how many have scored 1, how many have scored 3….how many have scored 25. The result should be populated in a list and returned. | |
| #sort_marks(): Sort the marks in the increasing order from 0 to 25. The sorted values should be populated in a list and returned.# | |
| #Sample Input Expected Output | |
| #list_of_marks = (12,18,25,24,2,5,18,20,20,21) 70.0 | |
| # [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 2, 1, 0, 0, 1, 1] | |
| # [2, 5, 12, 18, 18, 20, 20, 21, 24, 25] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PF-Assgn-34 | |
| #Sample Input Expected Output | |
| #[1, 2, 7, 4, 5, 6, 0, 3], 6 3 | |
| #[3, 4, 1, 8, 5, 9, 0, 6], 9 4 | |
| Estimated Time: 30 minutes | |
| def find_pairs_of_numbers(num_list,n): | |
| count=0 | |
| for x in num_list: | |
| index=num_list.index(x)+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PF-Exer-29 | |
| def merge_lists(list1,list2): | |
| for x in range(len(list2)): | |
| list1.append(list2[x]) | |
| new_merge_list=list1 | |
| return new_merge_list | |
| def sort_list(merged_list): | |
| merged_list=sorted(merged_list) | |
| return merged_list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PF-Assgn-33 | |
| #Sample Input Expected output | |
| #"I like Python" | |
| #"Java is a very popular language" lieyon | |
| #========================================================================================================================== | |
| def find_common_characters(msg1,msg2): | |
| list=[] | |
| for x in msg1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PF-Assgn-32 | |
| #{"P":"Pediatrics","O":"Orthopedics","E":"ENT} | |
| #Sample Input Expected Output | |
| #[101,P,102,O,302,P,305,P] Pediatrics | |
| #[101,O,102,O,302,P,305,E,401,O,656,O] Orthopedics | |
| #[101,O,102,E,302,P,305,P,401,E,656,O,987,E] ENT | |
| #================================================================================================================ | |
| def max_visited_speciality(patient_medical_speciality_list,medical_speciality): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PF-Assgn-31 | |
| def check_palindrome(word): | |
| x=word[::-1] | |
| if x== word: | |
| return True | |
| else: | |
| return False | |
| status=check_palindrome("malayalam") | |
| if(status): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PF-Assgn-30 | |
| #Sample Input Expected Output | |
| #AAAABBBBCCCCCCCC 4A4B8C | |
| #AABCCA 2A1B2C1A | |
| #==================================================================================================================== | |
| def encode(message): | |
| output='' | |
| privious=message[0] |
NewerOlder