├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── 01_IPA 19-Nov-2021 ├── Question-1 │ ├── Question.txt │ └── solution.py └── Question-2 │ ├── Question.txt │ └── solution.py ├── 02_IPA 05-Dec-2021 ├── Question-1 │ ├── Question.txt │ └── solution.py └── Question-2 │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ └── solution.py ├── 03_IPA 25-Dec-2021 ├── Question 1 │ ├── 1.png │ └── solution.py └── Question 2 │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ └── solution.py ├── 04_IPA 14-Jan-2022 ├── Question 1 │ ├── 1.png │ ├── 2.png │ ├── 3.png │ └── solution.py └── Question 2 │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ └── solution.py ├── 06_CPA 09-May-2021 ├── 1.png ├── 2.png ├── 3.png └── Solution.py ├── 07_ IRA 20-Dec-2021 ├── Question.txt └── Solution.py ├── Bank-Balance-Complex ├── Question.txt └── Solution.py ├── CONTRIBUTING.md ├── Calculate-Student-Grade ├── Question │ ├── 1.png │ ├── 2.png │ ├── 3.png │ └── 4.png └── Solution │ └── solution.py ├── Cricket-Complex ├── 1.png ├── 2.png ├── 3.png ├── 4.png └── Solution.py ├── Employee-Organisation ├── Question │ ├── 1.png │ ├── 2.png │ ├── 3.png │ └── 4.png └── solution │ └── solution.py ├── LICENSE ├── Leave-Application-Complex ├── Question.txt └── Solution.py ├── Palindrome-Simple ├── Question.txt └── Solution.py ├── Prime-Number-Count-In-List ├── Question │ ├── 1.png │ └── 2.png └── Solution │ └── solution.py ├── Project-Costing-Complex ├── Question │ ├── 1.PNG │ ├── 2.PNG │ ├── 3.PNG │ └── 4.PNG └── solution │ └── Solution.py ├── README.md ├── Salary-Increment-Complex ├── Question.txt └── Solution.py ├── Student-Highest-Marks ├── Question.txt └── solution.py ├── University-Management-Complex ├── Question │ ├── py1.jpeg │ ├── py2.jpeg │ ├── py3.jpeg │ ├── py5.jpeg │ ├── py6.jpeg │ └── py7.jpeg └── Solution │ └── Solution.py ├── Vowel-String-Simple ├── Question.txt └── Solution.py └── Xplore.jpeg /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behaviour** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /01_IPA 19-Nov-2021/Question-1/Question.txt: -------------------------------------------------------------------------------- 1 | Question 1 2 | 3 | Write a python code to print the count of valid strings 4 | and invalid strings from a given list of strings 5 | 6 | A string is considered as valid if it contains combinations 7 | of alphabetes (in upper case or lower case) with/without 8 | spaces. 9 | 10 | Define a function to check if a given string is valid or not 11 | i.e if it contains combination of alphabetes. 12 | 13 | This function will take string as input and return True 14 | if the string is valid, otherwise will return False. 15 | 16 | Example: 17 | 18 | Input: 19 | 4 20 | HelloGood Morning 21 | abcd123Fghy 22 | India 23 | Progoto.c 24 | 25 | Output: 26 | Count Of Valid String = 2 27 | Count of Invalid String = 2 -------------------------------------------------------------------------------- /01_IPA 19-Nov-2021/Question-1/solution.py: -------------------------------------------------------------------------------- 1 | # Input: 2 | # 4 3 | # HelloGood Morning 4 | # abcd123Fghy 5 | # India 6 | # Progoto.c 7 | 8 | # Output: 9 | # Count Of Valid String = 2 10 | # Count of Invalid String = 2 11 | 12 | def isValidString(strLis): 13 | countValidString = 0 14 | CountInvalidString = 0 15 | for str in strLis: 16 | temp = "" 17 | for word in str.split(): 18 | temp = temp + word.strip() 19 | if temp.isalpha(): 20 | countValidString = countValidString + 1 21 | else: 22 | CountInvalidString = CountInvalidString + 1 23 | return [countValidString,CountInvalidString] 24 | 25 | strLis = [] 26 | for i in range(int(input())): 27 | strLis.append(input()) 28 | 29 | valid,Invalid = isValidString(strLis) 30 | print("Count Of Valid String = ",valid) 31 | print("Count of Invalid String =",Invalid) 32 | -------------------------------------------------------------------------------- /01_IPA 19-Nov-2021/Question-2/Question.txt: -------------------------------------------------------------------------------- 1 | Write a code to automate the process of calculation of bonus amount for Employees 2 | in an Organization. 3 | 4 | Define a class to create Employee object with the below attributes: 5 | employee_name of type String, 6 | designation of type String, 7 | salary of type Number, 8 | overTimeContribution of type dictionary having name of the month and overtime in 9 | hours (hours contributed as overtime for that month) as key:value pairs (month:overtime), 10 | overTimeStatus of type string representing whether employee is eligible for overtime or not. 11 | 12 | Define the required method in the Employee class which takes all the parameters in the 13 | above sequences except the attribute overTimeStatus and sets the value of attribute 14 | to parameter values while creating an object of the class. For the attribute 15 | overTimeStatus a default value is set as False. 16 | 17 | Define another class to create an organizantion object with the below attributes: 18 | employee_list of type list having Employee objects. 19 | 20 | Define the required method in the organizantion class which takes all the parameters 21 | in the above sequences and sets the value of attribute to parameters values while creating 22 | an object of the class. 23 | 24 | Define another method in the organizantion class to check if the employee is 25 | eligible for overtime bonus or not and update the values for the attribute 26 | overTimeStatus. 27 | 28 | This method takes the following as argument: 29 | 1. a number representing the overTimeThreshold. 30 | 31 | This method will update the value for the attribute overTimeStatus to True if 32 | the following condition is fulfilled: 33 | 34 | i. the value for the total overtime hours for all months recorded for the Employee 35 | is not less than the overtime threshold (the value passed as argument). 36 | ii. if above condition is not fulfilled, the value for the attribute overTimeStatus will 37 | remain as False. 38 | 39 | Define another method in the organization class to calculate the total bonus amount 40 | to be paid by the organization. 41 | 42 | The bonus amount is calculated only for eligible Employees (having overTimeStatus as True) 43 | based on the total overtime hours for all months recorded for the Employee and the 44 | rate per hour provided. 45 | 46 | This method will take as argument a number representing the rate per hour and will 47 | return the total amount the Organization will require to pay as bonus to all 48 | eligible Employees of the Organization. 49 | 50 | Note: 51 | All searches should be case insensitive. 52 | Consider no two employees have the same name. 53 | 54 | **All remaining things not relevant to question is omitted.** 55 | 56 | Input test case-1: 57 | 58 | 5 59 | Sunita 60 | Faculty 61 | 23000 62 | 2 63 | Jan 64 | 4 65 | March 66 | 6 67 | Arun 68 | Admin 69 | 30000 70 | 3 71 | Feb 72 | 4 73 | March 74 | 12 75 | June 76 | 10 77 | Dipak 78 | Admin 79 | 25000 80 | 3 81 | Jan 82 | 12 83 | July 84 | 5 85 | Aug 86 | 3 87 | Balen 88 | HR 89 | 12000 90 | 3 91 | Jan 92 | 12 93 | July 94 | 5 95 | Aug 96 | 3 97 | Tarun 98 | HR 99 | 78000 100 | 3 101 | Jan 102 | 12 103 | July 104 | 5 105 | Aug 106 | 3 107 | 18 108 | 100 109 | 110 | Output: 111 | 112 | Sunita False 113 | Arun True 114 | Dipak True 115 | Balen True 116 | Tarun True 117 | 8600 118 | 119 | Input test case-2: 120 | 121 | 5 122 | Sunita 123 | Faculty 124 | 23000 125 | 4 126 | Jan 127 | 4 128 | March 129 | 6 130 | apr 131 | 6 132 | June 133 | 3 134 | Arun 135 | Admin 136 | 30000 137 | 3 138 | Jan 139 | 4 140 | March 141 | 6 142 | apr 143 | 6 144 | Dipak 145 | Admin 146 | 25000 147 | 3 148 | Jan 149 | 4 150 | March 151 | 6 152 | apr 153 | 6 154 | Balen 155 | HR 156 | 12000 157 | 3 158 | Jan 159 | 4 160 | March 161 | 6 162 | apr 163 | 6 164 | Tarun 165 | HR 166 | 78000 167 | 3 168 | Jan 169 | 4 170 | March 171 | 6 172 | apr 173 | 6 174 | 30 175 | 100 176 | 177 | Output: 178 | 179 | Sunita False 180 | Arun False 181 | Dipak False 182 | Balen False 183 | Tarun False 184 | 0 185 | -------------------------------------------------------------------------------- /01_IPA 19-Nov-2021/Question-2/solution.py: -------------------------------------------------------------------------------- 1 | #################################### Test case - 1 ############################# 2 | # Input: 3 | 4 | # 5 5 | # Sunita 6 | # Faculty 7 | # 23000 8 | # 2 9 | # Jan 10 | # 4 11 | # March 12 | # 6 13 | # Arun 14 | # Admin 15 | # 30000 16 | # 3 17 | # Feb 18 | # 4 19 | # March 20 | # 12 21 | # June 22 | # 10 23 | # Dipak 24 | # Admin 25 | # 25000 26 | # 3 27 | # Jan 28 | # 12 29 | # July 30 | # 5 31 | # Aug 32 | # 3 33 | # Balen 34 | # HR 35 | # 12000 36 | # 3 37 | # Jan 38 | # 12 39 | # July 40 | # 5 41 | # Aug 42 | # 3 43 | # Tarun 44 | # HR 45 | # 78000 46 | # 3 47 | # Jan 48 | # 12 49 | # July 50 | # 5 51 | # Aug 52 | # 3 53 | # 18 54 | # 100 55 | 56 | # Output: 57 | 58 | # Sunita False 59 | # Arun True 60 | # Dipak True 61 | # Balen True 62 | # Tarun True 63 | # 8600 64 | 65 | #################################### Test case - 2 ########################### 66 | 67 | # Input: 68 | 69 | # 5 70 | # Sunita 71 | # Faculty 72 | # 23000 73 | # 4 74 | # Jan 75 | # 4 76 | # March 77 | # 6 78 | # apr 79 | # 6 80 | # June 81 | # 3 82 | # Arun 83 | # Admin 84 | # 30000 85 | # 3 86 | # Jan 87 | # 4 88 | # March 89 | # 6 90 | # apr 91 | # 6 92 | # Dipak 93 | # Admin 94 | # 25000 95 | # 3 96 | # Jan 97 | # 4 98 | # March 99 | # 6 100 | # apr 101 | # 6 102 | # Balen 103 | # HR 104 | # 12000 105 | # 3 106 | # Jan 107 | # 4 108 | # March 109 | # 6 110 | # apr 111 | # 6 112 | # Tarun 113 | # HR 114 | # 78000 115 | # 3 116 | # Jan 117 | # 4 118 | # March 119 | # 6 120 | # apr 121 | # 6 122 | # 30 123 | # 100 124 | 125 | # Output: 126 | 127 | # Sunita False 128 | # Arun False 129 | # Dipak False 130 | # Balen False 131 | # Tarun False 132 | # 0 133 | 134 | class Employee: 135 | def __init__(self,employee_name,designation,salary,overTimeContribution): 136 | self.employee_name = employee_name 137 | self.designation = designation 138 | self.salary = salary 139 | self.overTimeContribution = overTimeContribution 140 | self.overTimeStatus = False 141 | 142 | class Organization(Employee): 143 | def __init__(self,employee_list): 144 | self.employee_list = employee_list 145 | 146 | def isEligibleForBonus(self,overTimeThreshold): 147 | for obj in self.employee_list: 148 | totalOverTimeHours = 0 149 | for k,v in obj.overTimeContribution.items(): 150 | totalOverTimeHours = totalOverTimeHours + v 151 | if totalOverTimeHours >= overTimeThreshold: 152 | obj.overTimeStatus = True 153 | 154 | def totalBonusToBePaid(self,ratePerHour): 155 | total = 0 156 | for obj in self.employee_list: 157 | if obj.overTimeStatus: 158 | for k,v in obj.overTimeContribution.items(): 159 | total = total + v*ratePerHour 160 | return total 161 | 162 | n = int(input()) 163 | obj_list = [] 164 | for _ in range(n): 165 | employee_name = input() 166 | designation = input() 167 | salary = int(input()) 168 | overTimeContribution = {} 169 | for _ in range(int(input())): 170 | key = input() 171 | value = int(input()) 172 | overTimeContribution[key] = value 173 | obj_list.append(Employee(employee_name,designation,salary,overTimeContribution)) 174 | 175 | org_obj = Organization(obj_list) 176 | overTimeThreshold = int(input()) 177 | ratePerHour = int(input()) 178 | 179 | org_obj.isEligibleForBonus(overTimeThreshold) 180 | totalBonus = org_obj.totalBonusToBePaid(ratePerHour) 181 | for i in obj_list: 182 | print(i.employee_name,i.overTimeStatus,sep=" ") 183 | print(totalBonus) 184 | -------------------------------------------------------------------------------- /02_IPA 05-Dec-2021/Question-1/Question.txt: -------------------------------------------------------------------------------- 1 | Write a python code to print the possition or index of a given string (taken 2 | as an input from user) from a given list of strings. 3 | 4 | The program will take an input from the user in the form of a string and will 5 | pass the string as argument to a function. The function will take the strings 6 | as argument and return Position(or index) of the list if the passed string is 7 | present in the list, else it'll return "String not found". If the passed strings 8 | is present at multiple indices, in that case the function should only return The 9 | first index of occurrence. 10 | 11 | considering the above scenario into account, build the logic to print the position 12 | of passed string from a given list of strings. 13 | 14 | Refer to below instructions and sample input-Output for more clarity on the requirement. 15 | 16 | Input: 17 | 4 18 | Hello Good Morning 19 | abcd123Fghy 20 | India 21 | Progoti.c 22 | India 23 | 24 | Output: 25 | Position of the searched string is: 2 26 | -------------------------------------------------------------------------------- /02_IPA 05-Dec-2021/Question-1/solution.py: -------------------------------------------------------------------------------- 1 | def isPresent(lis,st): 2 | for i in range(0, len(lis)): 3 | if lis[i] == st: 4 | return i 5 | else: 6 | return -1 7 | 8 | lis = [] 9 | for j in range(int(input())): 10 | lis.append(input()) 11 | st = input() 12 | 13 | ind = isPresent(lis,st) 14 | 15 | if ind == -1: 16 | print("String not found") 17 | else: 18 | print("Position of the searched string is: ",ind) 19 | 20 | 21 | # Input: 22 | # 4 23 | # Hello Good Morning 24 | # abcd123Fghy 25 | # India 26 | # Progoti.c 27 | # India 28 | 29 | # Output: 30 | # Position of the searched string is: 2 31 | -------------------------------------------------------------------------------- /02_IPA 05-Dec-2021/Question-2/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/02_IPA 05-Dec-2021/Question-2/1.png -------------------------------------------------------------------------------- /02_IPA 05-Dec-2021/Question-2/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/02_IPA 05-Dec-2021/Question-2/2.png -------------------------------------------------------------------------------- /02_IPA 05-Dec-2021/Question-2/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/02_IPA 05-Dec-2021/Question-2/3.png -------------------------------------------------------------------------------- /02_IPA 05-Dec-2021/Question-2/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/02_IPA 05-Dec-2021/Question-2/4.png -------------------------------------------------------------------------------- /02_IPA 05-Dec-2021/Question-2/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/02_IPA 05-Dec-2021/Question-2/5.png -------------------------------------------------------------------------------- /02_IPA 05-Dec-2021/Question-2/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/02_IPA 05-Dec-2021/Question-2/6.png -------------------------------------------------------------------------------- /02_IPA 05-Dec-2021/Question-2/solution.py: -------------------------------------------------------------------------------- 1 | 2 | # Input: 3 | 4 | # 3 5 | # 3 6 | # 1 7 | # Halmet 8 | # shakesphere 9 | # 2 10 | # Macbeth 11 | # SHAKESPHERE 12 | # 3 13 | # othrllo 14 | # Shakesphere 15 | # A-10 16 | # gomtinagar 17 | # lucknow 18 | # u.p. 19 | # 201876 20 | # 3 21 | # 1 22 | # A Christmas Carol. 23 | # Charies Dickens 24 | # 2 25 | # Bleak House 26 | # Charies Dickens 27 | # 3 28 | # Oliver Twist 29 | # Charies Dickens 30 | # A-770 31 | # rajamandi 32 | # agara 33 | # u.p. 34 | # 2018763 35 | # 3 36 | # 1 37 | # The adventures of sherlock holmes 38 | # sherlock holmes 39 | # 2 40 | # The return of sherlock holmes 41 | # sherlock holmes 42 | # 3 43 | # The sign of the four 44 | # sherlock holmes 45 | # A-660 46 | # Khairatabad 47 | # lucknow 48 | # u.p. 49 | # 201876 50 | # lucknow 51 | 52 | class Book: 53 | def __init__(self,bookId,bookName,nameOfAuthor): 54 | self.bookId = bookId 55 | self.bookName = bookName 56 | self.nameOfAuthor = nameOfAuthor 57 | 58 | class Library(Book): 59 | def __init__(self,bookLis,libraryAddress): 60 | self.bookLis = bookLis 61 | self.libraryAddress = libraryAddress 62 | 63 | def booksByAuthors(self): 64 | autDic = {} 65 | autLis = [] 66 | for obj in self.bookLis: 67 | autLis.append(obj.nameOfAuthor.upper()) 68 | authors = list(set(autLis)) 69 | for aut in authors: 70 | autDic[aut] = autLis.count(aut) 71 | return autDic 72 | 73 | def findbookType(city,libObj): 74 | books = [] 75 | for obj in libObj: 76 | for k,v in obj.libraryAddress.items(): 77 | if v == city: 78 | tempBooks=[] 79 | for book_obj in obj.bookLis: 80 | tempBooks.append(book_obj.bookName) 81 | tempBooks.reverse() 82 | books = books + tempBooks 83 | return books 84 | 85 | libObj = [] 86 | n = int(input()) 87 | for _ in range(n): 88 | bookList = [] 89 | libraryAddress = {} 90 | for i in range(int(input())): 91 | bookId = int(input()) 92 | bookName = input() 93 | nameOfAuthor = input() 94 | bookList.append(Book(bookId,bookName,nameOfAuthor)) 95 | libraryAddress['street'] = input() 96 | libraryAddress['area'] = input() 97 | libraryAddress['city'] = input() 98 | libraryAddress['state'] = input() 99 | libraryAddress['zip'] = input() 100 | libObj.append(Library(bookList,libraryAddress)) 101 | 102 | city = input() 103 | obj = libObj[0] 104 | res = obj.booksByAuthors() 105 | print(*res.keys(), *res.values()) 106 | books = findbookType(city,libObj) 107 | print(books) 108 | -------------------------------------------------------------------------------- /03_IPA 25-Dec-2021/Question 1/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/03_IPA 25-Dec-2021/Question 1/1.png -------------------------------------------------------------------------------- /03_IPA 25-Dec-2021/Question 1/solution.py: -------------------------------------------------------------------------------- 1 | st = input() 2 | n = int(input()) 3 | 4 | if len(st) % 2 != 0: 5 | mid = len(st)//2 6 | else: 7 | mid = (len(st)//2) - 1 8 | 9 | if len(st[mid:mid+n]) == n: 10 | print(st[mid:mid+n]) 11 | else: 12 | print(st[mid:]) 13 | -------------------------------------------------------------------------------- /03_IPA 25-Dec-2021/Question 2/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/03_IPA 25-Dec-2021/Question 2/1.png -------------------------------------------------------------------------------- /03_IPA 25-Dec-2021/Question 2/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/03_IPA 25-Dec-2021/Question 2/2.png -------------------------------------------------------------------------------- /03_IPA 25-Dec-2021/Question 2/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/03_IPA 25-Dec-2021/Question 2/3.png -------------------------------------------------------------------------------- /03_IPA 25-Dec-2021/Question 2/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/03_IPA 25-Dec-2021/Question 2/4.png -------------------------------------------------------------------------------- /03_IPA 25-Dec-2021/Question 2/solution.py: -------------------------------------------------------------------------------- 1 | 2 | # 2 3 | # 12345 4 | # 12 5 | # 30.0 6 | # 10.0 7 | # salary 8 | # 45678 9 | # 98 10 | # 400.0 11 | # 200.0 12 | # salary 13 | # 45678 14 | # 98 15 | # 100 16 | # salary 17 | 18 | from collections import OrderedDict 19 | 20 | class Account: 21 | def __init__(self,cardNumber,pin,balance,withdrawalAmount,accountType): 22 | self.cardNumber = cardNumber 23 | self.pin = pin 24 | self.balance = balance 25 | self.withdrawalAmount = withdrawalAmount 26 | self.accountType = accountType 27 | 28 | def calculateBalance(self,withdAmount): 29 | if self.balance >= withdAmount: 30 | self.balance = self.balance - withdAmount 31 | self.withdrawalAmount = withdAmount 32 | 33 | class ATM(Account): 34 | def __init__(self,obj_lis): 35 | self.obj_lis = obj_lis 36 | 37 | def updatedBalance(self,cardNo,cardPin,withdAmount): 38 | for obj in self.obj_lis: 39 | if obj.cardNumber == cardNo and obj.pin == cardPin: 40 | obj.calculateBalance(withdAmount) 41 | return obj 42 | else: 43 | return None 44 | 45 | def printBalance(self,acntType): 46 | acntDic = {} 47 | for obj in self.obj_lis: 48 | if obj.accountType == acntType: 49 | acntDic[obj.cardNumber] = obj.balance 50 | return acntDic 51 | 52 | n = int(input()) 53 | obj_lis = [] 54 | for _ in range(n): 55 | cardNumber = int(input()) 56 | pin = int(input()) 57 | balance = float(input()) 58 | withdrawalAmount = float(input()) 59 | accountType = input() 60 | obj_lis.append(Account(cardNumber,pin,balance,withdrawalAmount,accountType)) 61 | 62 | cardNo = int(input()) 63 | cardPin = int(input()) 64 | withdAmount = float(input()) 65 | acntType = input() 66 | 67 | ATM_obj = ATM(obj_lis) 68 | obj1 = ATM_obj.updatedBalance(cardNo,cardPin,withdAmount) 69 | dic = ATM_obj.printBalance(acntType) 70 | dic1 = dict(sorted(dic.items(), key=lambda items: items[1])) 71 | print(obj1.cardNumber,obj1.balance,obj1.withdrawalAmount) 72 | for k,v in dic1.items(): 73 | print(k, v) 74 | -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 1/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/04_IPA 14-Jan-2022/Question 1/1.png -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 1/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/04_IPA 14-Jan-2022/Question 1/2.png -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 1/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/04_IPA 14-Jan-2022/Question 1/3.png -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 1/solution.py: -------------------------------------------------------------------------------- 1 | st1 = input() 2 | st2 = input().lower() 3 | flag = False 4 | 5 | for word in st1.split(): 6 | for ch in word: 7 | if not ch.lower() in st2: 8 | flag = True 9 | break 10 | if flag: 11 | break 12 | 13 | if flag: 14 | print("Input string is not valid") 15 | print(st1) 16 | else: 17 | print("Input string is valid") 18 | print(st1) 19 | 20 | 21 | 22 | """ 23 | 24 | # straight forward approach 25 | n = int(input()) 26 | for i in range(0,n): 27 | a = input() 28 | b = input() 29 | c = b.upper() + b.lower() # gathering all the lower case and upper case possibilities of the letters present in the second string 30 | k = 0 31 | 32 | for j in a: 33 | if j not in c: 34 | print("string is invalid") 35 | print(a) 36 | break 37 | k += 1 38 | if(k == len(a)): 39 | print("string is valid") 40 | print(a) 41 | 42 | """ 43 | -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 2/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/04_IPA 14-Jan-2022/Question 2/1.png -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 2/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/04_IPA 14-Jan-2022/Question 2/2.png -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 2/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/04_IPA 14-Jan-2022/Question 2/3.png -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 2/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/04_IPA 14-Jan-2022/Question 2/4.png -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 2/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/04_IPA 14-Jan-2022/Question 2/5.png -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 2/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/04_IPA 14-Jan-2022/Question 2/6.png -------------------------------------------------------------------------------- /04_IPA 14-Jan-2022/Question 2/solution.py: -------------------------------------------------------------------------------- 1 | # 4 2 | # 101 3 | # jhon M 4 | # specialist 5 | # 6 6 | # 102 7 | # Mitul Barua 8 | # Faculty 9 | # 4 10 | # 103 11 | # Rosy Borah 12 | # Faculty 13 | # 3 14 | # 104 15 | # Reza 16 | # Generalist 17 | # 2 18 | # faculty 19 | # 4 20 | # Specialist 21 | # 5 22 | # Generalist 23 | # 3 24 | 25 | class Employee: 26 | def __init__(self, empId, empName, role, age_in_role): 27 | self.empId = empId 28 | self.empName = empName 29 | self.role = role 30 | self.age_in_role = age_in_role 31 | self.promotion = None 32 | 33 | class Organization: 34 | def __init__(self, empList, promoDic): 35 | self.empList = empList 36 | self.promoDic = promoDic 37 | 38 | def calculateEligibilityStatus(self): 39 | details = {} 40 | for obj in self.empList: 41 | for key,value in self.promoDic.items(): 42 | if obj.role.lower() == key.lower(): 43 | if obj.age_in_role == self.promoDic[key]: 44 | details[obj.empId] = "eligible" 45 | obj.promotion = True 46 | elif obj.age_in_role > self.promoDic[key]: 47 | details[obj.empId] = "overdue" 48 | obj.promotion = True 49 | elif obj.age_in_role < self.promoDic[key]: 50 | details[obj.empId] = str(self.promoDic[key] - obj.age_in_role) + " years left" 51 | return details 52 | 53 | empObjLis = [] 54 | for _ in range(int(input())): 55 | empId = int(input()) 56 | empName = input() 57 | role = input() 58 | age_in_role = int(input()) 59 | empObjLis.append(Employee(empId,empName,role,age_in_role)) 60 | 61 | promoDic = {} 62 | for i in range(3): 63 | key = input() 64 | value = int(input()) 65 | promoDic[key] = value 66 | 67 | obj = Organization(empObjLis, promoDic) 68 | details = obj.calculateEligibilityStatus() 69 | for k,v in details.items(): 70 | print(k, v) 71 | -------------------------------------------------------------------------------- /06_CPA 09-May-2021/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/06_CPA 09-May-2021/1.png -------------------------------------------------------------------------------- /06_CPA 09-May-2021/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/06_CPA 09-May-2021/2.png -------------------------------------------------------------------------------- /06_CPA 09-May-2021/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/06_CPA 09-May-2021/3.png -------------------------------------------------------------------------------- /06_CPA 09-May-2021/Solution.py: -------------------------------------------------------------------------------- 1 | # 4 2 | # 101 3 | # Kadamb 4 | # 500 5 | # Portrait 6 | # 102 7 | # Suman 8 | # 3000 9 | # Portrait 10 | # 103 11 | # Suman 12 | # 3000 13 | # Modern 14 | # 104 15 | # Kadamb 16 | # 3000 17 | # portrait 18 | # landscape 19 | 20 | # 5 21 | # 101 22 | # Raman 23 | # 50000 24 | # Portrait 25 | # 102 26 | # Kamaal 27 | # 30000 28 | # Portrait 29 | # 103 30 | # Raman 31 | # 25600 32 | # Modern 33 | # 104 34 | # Preeti 35 | # 31000 36 | # landscape 37 | # 105 38 | # Sumiran 39 | # 50000 40 | # modern 41 | # modern 42 | 43 | 44 | class Painting: 45 | def __init__(self, paintingId, painterName, paintingPrice, paintingType): 46 | self.paintingId = paintingId 47 | self.painterName = painterName 48 | self.paintingPrice = paintingPrice 49 | self.paintingType = paintingType 50 | 51 | class Showroom: 52 | def __init__(self, paintingObj): 53 | self.paintingList = paintingObj 54 | 55 | def getTotalPaintingPrice(self, type): 56 | su = 0 57 | isFound = False 58 | for obj in self.paintingList: 59 | if obj.paintingType.lower() == type.lower(): 60 | su = su + obj.paintingPrice 61 | isFound = True 62 | if isFound: 63 | return su 64 | else: 65 | return "No painting found" 66 | 67 | def getPainterWithMaxCountOfPaintings(self): 68 | dic = {} 69 | for obj in self.paintingList: 70 | if obj.painterName not in dic: 71 | dic[obj.painterName] = 1 72 | else: 73 | dic[obj.painterName] = dic[obj.painterName] + 1 74 | 75 | dic1 = dict(sorted(dic.items(), key = lambda item:item[1], reverse=True)) 76 | print(dic1) 77 | lis = [] 78 | for k,v in dic1.items(): 79 | if len(lis) == 0: 80 | lis.append(k) 81 | temp = v 82 | else: 83 | if temp == v: 84 | lis.append(k) 85 | else: 86 | break 87 | lis.sort() 88 | return lis[0] 89 | 90 | 91 | paintingObj = [] 92 | for i in range(int(input())): 93 | paintingId = int(input()) 94 | painterName = input() 95 | paintingPrice = int(input()) 96 | paintingType = input() 97 | paintingObj.append(Painting(paintingId,painterName,paintingPrice,paintingType)) 98 | 99 | obj = Showroom(paintingObj) 100 | type = input() 101 | totalPrice = obj.getTotalPaintingPrice(type) 102 | painter = obj.getPainterWithMaxCountOfPaintings() 103 | # painter.sort() 104 | print(totalPrice) 105 | print(painter) 106 | -------------------------------------------------------------------------------- /07_ IRA 20-Dec-2021/Question.txt: -------------------------------------------------------------------------------- 1 | Write the code to define a class to create Employee objects with the 2 | below attributes : 3 | Name 4 | designation 5 | salary 6 | Loan details ( stores the details of different types of loans 7 | employee has taken along with the amount borrowed for a loan type 8 | as key : value pairs - loan type : borrowed amount ). 9 | 10 | Define the method in the class which takes as argument values for 11 | all attributes in the above sequence and set the value of attributes 12 | to parameter values while creating an Employee object. 13 | 14 | Write the code to define a class to create an Organization object 15 | with the below attributes : 16 | 17 | 1. A list of Employee objects 18 | 2. A list of types of loans Organization offers to employees 19 | 3. Designation wise eligible maximum loan amount stored as 20 | key : value pairs - designation : maximum eligible loan amount. 21 | 22 | Define a method which takes as argument value of the attribute 23 | and initialize the attribute with the given value while creating 24 | an Organization object . 25 | 26 | Define another two methods inside the Organization class as 27 | described below : 28 | 29 | A. 30 | 31 | A method to check if an employee is eligible to take a loan or not. 32 | 33 | Method take as arguments - 34 | 1. A string representing the name of an employee. 35 | 2. A string representing a loan type. 36 | 3. A number representing the amount want to borrow as loan. 37 | 38 | If the following conditions are fulfilled , method will return True 39 | and add the value passed as argument for loan type and borrowing 40 | amount ( the 2nd argument and 3rd argument ) as key : value pair to 41 | the loan details of the employee . Conditions to be fulfilled are : 42 | 43 | 1. An employee with the name passed as the first argument is present in 44 | the employee list of the organization 45 | 46 | 2. If the employee has not taken the loan of the type given as the 47 | second argument earlier.(not present in the loan details of the employee) 48 | 49 | 3. If loan of the type given as the second argument is present in the 50 | list of loan types of the Organization 51 | 52 | 4. If the amount want to borrow as loan (the value passed as 3rd argument) 53 | plus the summation of already borrowed loan amount for different loan 54 | types available in Loan details of the Employee is not greater than 55 | the maximum eligible loan amount for the designation of the Employee 56 | as per the Designation wise eligible maximum loan amount of the 57 | Organization . 58 | 59 | If any of these conditions is not fulfilled, method returns False. 60 | 61 | B. 62 | 63 | A method to find and return the designation wise count of 64 | employees in the Employee list of the Organization still eligible 65 | to borrow loans . An employee with a particular designation is 66 | eligible to borrow a loan only if his / her summation of already 67 | borrowed loans of different type is less than the maximum eligible 68 | loan amount for that designation as per the Designation wise eligible 69 | maximum loan amount of the Organization . 70 | 71 | Note : 72 | • All search should be case insensitive . 73 | • Consider no two employees have the same name . 74 | 75 | Instructions to write main section of the code : 76 | a . You would require to write the main section completely, 77 | hence please follow the below instructions for the same. 78 | 79 | b . You would require to write the main program which is inline 80 | to the " sample input description section " mentioned below and 81 | to read the data in the same sequence . 82 | 83 | C. Create the respective objects ( Employee an Organization ) 84 | with the given sequence of arguments to fulfill the method 85 | defined in the respective classes referring to the below instructions . 86 | 87 | i . Create a list of Employee objects . To creat the list 88 | 89 | 1. Take as input the count of employee objects you want to create 90 | 91 | 2. Create a Employee object after reading the data related to Name , designation , salary and Loan Details and add the object to the list of Employee objects which will be provided to 92 | 93 | the Organization object . This point repeats for the number of Employee objects considered on the first line of input, point #ci. 94 | 1) to be treated To create the Loan Details dictionary for each employee object, take as input the count of elements you want to add to the dictionary. 95 | i. Create a (Loan Type: Borrowed amount) key: value pair after reading the data related to it and add the pair to the dictionary for the number of element count read. ii. Create a list of loan types for types of loans offered by the Organization to the Employees by reading the count of loan types you want to add to the list followed by that many loan types one after another iii. Create the dictionary for Designation wise eligible maximum loan amount for the Organization. To create the dictionary, read the count of elements you want to store in the dictionary followed by that read that many pairs of values for "designation : maximum eligible loan amount" one after another and add to the dictionary 96 | iv. Create Organization object by passing the List of Employee objects (created in point #c.i), the 97 | list of loan types (created in point #ci) and dictionary for Designation wise eligible maximum loan amount(created in point #c.) as the arguments d. Take a string as employee name to be passed for the 1st argument to the method defined above to check if an employee is eligible for a loan or not. 98 | e. Take another string as loan type to be passed for the 2nd argument to the method defined above to check if an emplovee is eligible for a method. In the output, the key and values are printed separated by a "." from the dictionary. 99 | 100 | for example: 101 | Programmer:3 102 | Analyst:2 103 | You may refer to the sample output for the display format. 104 | You can use/refer the below given sample input and output to verify your solution using 'Test against Custom Input ' option in Hackerrank. 105 | Input Format for Custom Testing 106 | a. The 1st input taken in the main section is the number of Employee objects to be added to the 107 | list of employee. 108 | b. The next set of inputs are the values related to attributes of Employee objects to be added to 109 | the employee List. - the employee name, designation, salary and the count of elements to be added in the Loan details of the Employee followed by the values for loan type and borrowed amount for each element to be added to the Loan details. The above point repeats for the number of 110 | employee objects, read in point#a c. The next lines of input refers the count of loan types followed by the values for loan types. 111 | d. The next lines of inputs are the count of designation wise eligible maximum loan amount pairs to be stored in the organization. 112 | 113 | 114 | Sample Testcase 1: 115 | Input: 116 | 117 | 5 118 | Sunita 119 | Faculty 120 | 23000 121 | 1 122 | Home 123 | 200000 124 | 125 | Arun 126 | Programmer 127 | 30000 128 | 1 129 | Personal 130 | 4000 131 | 132 | Dipak 133 | Tester 134 | 25000 135 | 2 136 | Travel 137 | 10000 138 | Personal 139 | 5000 140 | 141 | Balen 142 | Analyst 143 | 12000 144 | 1 145 | Travel 146 | 2000 147 | 148 | Tarun 149 | Programmer 150 | 78000 151 | 2 152 | Personal 153 | 100000 154 | Travel 155 | 2000 156 | 157 | 3 158 | Travel 159 | Home 160 | Personal 161 | 162 | 3 163 | Programmer 164 | 300000 165 | Faculty 166 | 200000 167 | Analyst 168 | 100000 169 | 170 | Tarun 171 | Home 172 | 50000 173 | 174 | 175 | Testcase Output : 176 | Loan granted . 177 | Personal : 100000 178 | Travel : 2000 179 | Home : 50000 180 | Programmer : 2 181 | Faculty : 0 182 | Analyst : 1 183 | -------------------------------------------------------------------------------- /07_ IRA 20-Dec-2021/Solution.py: -------------------------------------------------------------------------------- 1 | 2 | # 5 3 | # Sunita 4 | # Faculty 5 | # 23000 6 | # 1 7 | # Home 8 | # 200000 9 | # Arun 10 | # Programmer 11 | # 30000 12 | # 1 13 | # Personal 14 | # 4000 15 | # Dipak 16 | # Tester 17 | # 25000 18 | # 2 19 | # Travel 20 | # 10000 21 | # Personal 22 | # 5000 23 | # Balen 24 | # Analyst 25 | # 12000 26 | # 1 27 | # Travel 28 | # 2000 29 | # Tarun 30 | # Programmer 31 | # 78000 32 | # 2 33 | # Personal 34 | # 100000 35 | # Travel 36 | # 2000 37 | # 3 38 | # Travel 39 | # Home 40 | # Personal 41 | # 3 42 | # Programmer 43 | # 300000 44 | # Faculty 45 | # 200000 46 | # Analyst 47 | # 100000 48 | # Tarun 49 | # Home 50 | # 50000 51 | 52 | class Employee: 53 | def __init__(self,empName,empDesignation, empSalary, loan): 54 | self.empName = empName 55 | self.empDesignation = empDesignation 56 | self.empSalary = empSalary 57 | self.loan = loan 58 | 59 | class Organization: 60 | def __init__(self,empObj,loanType,maxDesiganationAmount): 61 | self.empList = empObj 62 | self.loanType = loanType 63 | self.maxDesiganationAmount = maxDesiganationAmount 64 | 65 | def eligibleForLoan(self,name,type,amount): 66 | isFound = False 67 | for obj in self.empList: 68 | if obj.empName.lower() == name.lower() and type.lower() not in obj.loan and type.lower() in self.loanType: 69 | su = amount 70 | 71 | for _,v in obj.loan.items(): 72 | su = su + v 73 | 74 | for k,v in self.maxDesiganationAmount.items(): 75 | if k == obj.empDesignation.lower(): 76 | if su < v: 77 | obj.loan[type] = amount 78 | return obj 79 | else: 80 | return False 81 | if not isFound: 82 | return False 83 | 84 | def stillEligibleForLoan(self): 85 | eligible = {} 86 | for obj in self.empList: 87 | su = 0 88 | des = obj.empDesignation 89 | for k,v in obj.loan.items(): 90 | su = su + v 91 | if des.lower() in self.maxDesiganationAmount: 92 | if su < self.maxDesiganationAmount[des.lower()]: 93 | if des not in eligible: 94 | eligible[des] = 1 95 | else: 96 | eligible[des] = eligible[des] + 1 97 | else: 98 | eligible[des] = 0 99 | dic1 = dict(sorted(eligible.items(), key=lambda item:item[0], reverse=True)) 100 | return dic1 101 | 102 | empObj = [] 103 | for _ in range(int(input())): 104 | empName = input() 105 | empDesignation = input() 106 | empSalary = int(input()) 107 | loan = {} 108 | for i in range(int(input())): 109 | key = input().lower() 110 | value = int(input()) 111 | loan[key] = value 112 | empObj.append(Employee(empName,empDesignation,empSalary,loan)) 113 | 114 | loanType = [] 115 | for _ in range(int(input())): 116 | inp = input().lower() 117 | loanType.append(inp) 118 | 119 | maxDesiganationAmount = {} 120 | for _ in range(int(input())): 121 | key = input().lower() 122 | value = int(input()) 123 | maxDesiganationAmount[key] = value 124 | 125 | name = input() 126 | type = input() 127 | amount = int(input()) 128 | 129 | obj = Organization(empObj,loanType,maxDesiganationAmount) 130 | res = obj.eligibleForLoan(name,type,amount) 131 | if res: 132 | print("Loan Granted.") 133 | for k,v in res.loan.items(): 134 | print(k,": ",v) 135 | else: 136 | print("Not Found") 137 | 138 | eligible = obj.stillEligibleForLoan() 139 | for k,v in eligible.items(): 140 | print(k,": ",v) 141 | -------------------------------------------------------------------------------- /Bank-Balance-Complex/Question.txt: -------------------------------------------------------------------------------- 1 | Create a Class Account with the parameters 2 | acc_no, 3 | name, 4 | balance. 5 | 6 | Define a function deposite_money() which takes a parameter 7 | dep_amnt as a number and updates the deposit money to the 8 | balance and returns the updated amount. 9 | 10 | Create another function withdraw_money() which takes a 11 | number as with_amnt. There should be a minimum amount 12 | present in the account which is 1000, so if the amount 13 | present in the account after withdrawing money is less 14 | than 1000 then return 0 otherwise return updated amount. 15 | 16 | Input: 17 | 12345 18 | Rajesh 19 | 1200 20 | 21 | d 22 | 1500 23 | output: 24 | 2700 25 | 26 | w 27 | 2000 28 | output: 29 | insufficient amount 30 | -------------------------------------------------------------------------------- /Bank-Balance-Complex/Solution.py: -------------------------------------------------------------------------------- 1 | class Account: 2 | def __init__(self,acc_no,name,balance): 3 | self.acc_no = acc_no 4 | self.name = name 5 | self.balance = balance 6 | 7 | def deposite_money(obj,dep_amnt): 8 | obj.balance = obj.balance + dep_amnt 9 | return obj.balance 10 | 11 | def withdraw_money(obj,with_amnt): 12 | obj.balance = obj.balance - with_amnt 13 | if obj.balance > 1000: 14 | return obj.balance 15 | else: 16 | return 0 17 | 18 | acc_no = int(input()) 19 | name = input() 20 | balance = int(input()) 21 | obj = Account(acc_no,name,balance) 22 | d_or_w = input() 23 | d_or_w_amnt = int(input()) 24 | if d_or_w == "d": 25 | result = Account.deposite_money(obj,d_or_w_amnt) 26 | print("Balance: ",result) 27 | else: 28 | result = Account.withdraw_money(obj,d_or_w_amnt) 29 | print("Amount is less then 1000:",result) 30 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Hello everyone, 2 | 3 | I hope this repositiry helped you in cracking your exams you can consider adding the new questions with solutions in this repository. 4 | Let's help othes also in cracking the exam. 5 | -------------------------------------------------------------------------------- /Calculate-Student-Grade/Question/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Calculate-Student-Grade/Question/1.png -------------------------------------------------------------------------------- /Calculate-Student-Grade/Question/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Calculate-Student-Grade/Question/2.png -------------------------------------------------------------------------------- /Calculate-Student-Grade/Question/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Calculate-Student-Grade/Question/3.png -------------------------------------------------------------------------------- /Calculate-Student-Grade/Question/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Calculate-Student-Grade/Question/4.png -------------------------------------------------------------------------------- /Calculate-Student-Grade/Solution/solution.py: -------------------------------------------------------------------------------- 1 | # Calculate Student Grade 2 | 3 | # Input: 4 | # 123 5 | # Rahul 6 | # 3 7 | # 80 8 | # 70 9 | # 80 10 | # 11 | # Output: 12 | # 76 13 | # B 14 | # 15 | # Input: 16 | # 200 17 | # Asha 18 | # 4 19 | # 90 20 | # 90 21 | # 80 22 | # 60 23 | # 24 | # Output: 25 | # 80 26 | # A 27 | 28 | class Student(object): 29 | def __init__(self,roll,name,marks_list): 30 | self.roll = roll 31 | self.name = name 32 | self.marks_list = marks_list 33 | 34 | def calculate_percentage(self,n): 35 | return sum(self.marks_list) // n 36 | 37 | def find_grade(self,percentage): 38 | if percentage >= 80: 39 | return 'A' 40 | elif percentage >= 60 and percentage < 80: 41 | return 'B' 42 | elif percentage >= 40 and percentage < 60: 43 | return 'C' 44 | elif percentage < 40: 45 | return 'F' 46 | 47 | roll = int(input()) 48 | name = input() 49 | marks_list = [] 50 | n = int(input()) 51 | for _ in range(n): 52 | marks_list.append(int(input())) 53 | 54 | obj = Student(roll,name,marks_list) 55 | percentage = obj.calculate_percentage(n) 56 | grade = obj.find_grade(percentage) 57 | print(percentage,grade,sep="\n") 58 | -------------------------------------------------------------------------------- /Cricket-Complex/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Cricket-Complex/1.png -------------------------------------------------------------------------------- /Cricket-Complex/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Cricket-Complex/2.png -------------------------------------------------------------------------------- /Cricket-Complex/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Cricket-Complex/3.png -------------------------------------------------------------------------------- /Cricket-Complex/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Cricket-Complex/4.png -------------------------------------------------------------------------------- /Cricket-Complex/Solution.py: -------------------------------------------------------------------------------- 1 | class Cricket_Player: 2 | def __init__(self,playerName,playedCountry,playerAge,playerCountry): 3 | self.playerName = playerName 4 | self.playedCountry = playedCountry 5 | self.playerAge = playerAge 6 | self.playerCountry = playerCountry 7 | 8 | class Solution: 9 | def __init__(self,objLis): 10 | self.playerList = objLis 11 | 12 | def countPlayers(self, countryName): 13 | count = 0 14 | for obj in self.playerList: 15 | if obj.playerCountry.lower() == countryName.lower(): 16 | count = count + 1 17 | return count 18 | 19 | def getPlayerPlayedForMaxCountry(self): 20 | max = 0 21 | name = "" 22 | for obj in self.playerList: 23 | tempMax = len(obj.playedCountry) 24 | tempName = obj.playerName 25 | if tempMax > max: 26 | max = tempMax 27 | name = tempName 28 | return name 29 | 30 | objLis = [] 31 | for _ in range(int(input())): 32 | playerName = input() 33 | playedCountry = [] 34 | for i in range(int(input())): 35 | temp = input() 36 | playedCountry.append(temp) 37 | playerAge = int(input()) 38 | playerCountry = input() 39 | objLis.append(Cricket_Player(playerName,playedCountry,playerAge,playerCountry)) 40 | 41 | obj = Solution(objLis) 42 | countryName = input() 43 | res_1 = obj.countPlayers(countryName) 44 | res_2 = obj.getPlayerPlayedForMaxCountry() 45 | print(res_1) 46 | print(res_2) 47 | 48 | # 3 49 | # virat 50 | # 5 51 | # aus 52 | # nze 53 | # eng 54 | # wi 55 | # pak 56 | # 35 57 | # ind 58 | # raina 59 | # 3 60 | # aus 61 | # pak 62 | # nze 63 | # 34 64 | # ind 65 | # gayle 66 | # 3 67 | # aus 68 | # ind 69 | # pak 70 | # 42 71 | # wi 72 | # ind 73 | -------------------------------------------------------------------------------- /Employee-Organisation/Question/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Employee-Organisation/Question/1.png -------------------------------------------------------------------------------- /Employee-Organisation/Question/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Employee-Organisation/Question/2.png -------------------------------------------------------------------------------- /Employee-Organisation/Question/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Employee-Organisation/Question/3.png -------------------------------------------------------------------------------- /Employee-Organisation/Question/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Employee-Organisation/Question/4.png -------------------------------------------------------------------------------- /Employee-Organisation/solution/solution.py: -------------------------------------------------------------------------------- 1 | 2 | # Employee Organisation 3 | 4 | # 2 5 | # A 6 | # 1 7 | # 30 8 | # M 9 | # B 10 | # 2 11 | # 40 12 | # F 13 | # 10 14 | # 50 15 | 16 | class Employee: 17 | def __init__(self,name,id,age,gender): 18 | self.name = name 19 | self.id = id 20 | self.age = age 21 | self.gender = gender 22 | 23 | class Organisation(Employee): 24 | 25 | def getEmployeeCount(obj_lis): 26 | return len(obj_lis) 27 | 28 | def findEmployeeAge(obj_lis,id): 29 | for i in obj_lis: 30 | if i.id == id: 31 | return i.age 32 | return -1 33 | 34 | def countEmployee(obj_lis,age): 35 | count = 0 36 | for i in obj_lis: 37 | if i.age == age: 38 | count = count + 1 39 | return count 40 | 41 | 42 | obj_lis = [] 43 | n = int(input()) 44 | for _ in range(n): 45 | name = input() 46 | id = int(input()) 47 | age = int(input()) 48 | gender = input() 49 | obj_lis.append(Employee(name,id,age,gender)) 50 | 51 | id = int(input()) 52 | age = int(input()) 53 | 54 | print(Organisation.getEmployeeCount(obj_lis)) 55 | print(Organisation.findEmployeeAge(obj_lis,id)) 56 | print(Organisation.countEmployee(obj_lis,age)) 57 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Harshit Gupta 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Leave-Application-Complex/Question.txt: -------------------------------------------------------------------------------- 1 | Create a class Employee which have 3 members 2 | emp_no, 3 | emp_name , 4 | leaves. 5 | Leaves is a dictionary with the three keys "EL", "CL", "SL" 6 | which are the type of leaves. 7 | 8 | Define __init__() to initialize the values. 9 | 10 | Create another class Company which has two fields 11 | cname and emps. 12 | 13 | cname is the company name and emps is the list of employees. 14 | 15 | Create a function leave_available() to which takes two 16 | parameters emp_no and type of leave and used to print 17 | the number of leaves remaining. 18 | 19 | Create another function leave_permission() which takes 20 | empno , type of leave and num of leave. 21 | 22 | if the available leave of a employee is greater than 23 | equal to the number of leaves employee want then 24 | print "Granted" else print "Rejected". 25 | 26 | Take 2 input of empno,empname,leaves(all type) 27 | take input empid,type of leaves,leaves duration and check if 28 | granted or not. 29 | 30 | Input: 31 | 2 32 | 1 33 | Rajesh 34 | 5 35 | 10 36 | 15 37 | 2 38 | Sudhir 39 | 10 40 | 10 41 | 10 42 | 1 43 | SL 44 | 20 45 | 46 | Output: 47 | 48 | 10 49 | Rejected 50 | -------------------------------------------------------------------------------- /Leave-Application-Complex/Solution.py: -------------------------------------------------------------------------------- 1 | # Leave Application 2 | 3 | class Employee: 4 | 5 | def __init__(self,emp_no,emp_name,leaves): 6 | self.emp_no = emp_no 7 | self.emp_name = emp_name 8 | self.leaves = leaves 9 | 10 | class Company(Employee): 11 | emps = [] 12 | 13 | def leave_available(empno,type_of_leave): 14 | for i in Company.emps: 15 | if i.emp_no == empno: 16 | for ek,ev in i.leaves.items(): 17 | if ek == type_of_leave: 18 | return ev 19 | 20 | def leave_permission(empno,type_of_leave,no_of_leave): 21 | leave = Company.leave_available(empno,type_of_leave) 22 | print(leave) 23 | if leave >= no_of_leave: 24 | return [leave, True] 25 | elif leave < no_of_leave: 26 | return [leave, False] 27 | 28 | n = int(input()) 29 | obj_list = [] 30 | for _ in range(n): 31 | leaves = {'EL': 0, 'CL': 0, 'SL':0} 32 | emp_no = int(input()) 33 | emp_name = input() 34 | for k,_ in leaves.items(): 35 | leaves[k] = int(input()) 36 | obj_list.append(Employee(emp_no,emp_name,leaves)) 37 | 38 | empno = int(input()) 39 | type_of_leave = input() 40 | no_of_leave = int(input()) 41 | 42 | Company.emps = obj_list 43 | result = Company.leave_permission(empno,type_of_leave,no_of_leave) 44 | remaning_leaves, isGranted = [j for j in result] 45 | 46 | if isGranted: 47 | print("Output:") 48 | print(remaning_leaves,"Granted",sep="\n") 49 | else: 50 | print("Output:") 51 | print(remaning_leaves,"Rejected",sep="\n") 52 | -------------------------------------------------------------------------------- /Palindrome-Simple/Question.txt: -------------------------------------------------------------------------------- 1 | Question 1: Make a function check_palindrome() that takes a list of 2 | strings as an argument. It returns the string which is a palindrome. 3 | 4 | Input: 5 | 3 6 | malayalam 7 | radar 8 | nitish 9 | 10 | Output: 11 | malayalam 12 | radar 13 | -------------------------------------------------------------------------------- /Palindrome-Simple/Solution.py: -------------------------------------------------------------------------------- 1 | # palindrome 2 | 3 | def check_palindrome(lis): 4 | palin_lis = [] 5 | for i in lis: 6 | if i == i[::-1]: 7 | palin_lis.append(i) 8 | return palin_lis 9 | 10 | lis = [] 11 | for i in range(int(input())): 12 | lis.append(input()) 13 | 14 | for _ in check_palindrome(lis): 15 | print(_) 16 | -------------------------------------------------------------------------------- /Prime-Number-Count-In-List/Question/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Prime-Number-Count-In-List/Question/1.png -------------------------------------------------------------------------------- /Prime-Number-Count-In-List/Question/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Prime-Number-Count-In-List/Question/2.png -------------------------------------------------------------------------------- /Prime-Number-Count-In-List/Solution/solution.py: -------------------------------------------------------------------------------- 1 | # Prime Number Count 2 | 3 | lis = [] 4 | count = 0 5 | n = int(input()) 6 | for _ in range(n): 7 | lis.append(int(input())) 8 | 9 | for i in range(0, n): 10 | if lis[i] != 1: 11 | for j in range(2, lis[i]): 12 | if lis[i] % j == 0: 13 | break 14 | else: 15 | count = count + 1 16 | 17 | print(count) 18 | -------------------------------------------------------------------------------- /Project-Costing-Complex/Question/1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Project-Costing-Complex/Question/1.PNG -------------------------------------------------------------------------------- /Project-Costing-Complex/Question/2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Project-Costing-Complex/Question/2.PNG -------------------------------------------------------------------------------- /Project-Costing-Complex/Question/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Project-Costing-Complex/Question/3.PNG -------------------------------------------------------------------------------- /Project-Costing-Complex/Question/4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Project-Costing-Complex/Question/4.PNG -------------------------------------------------------------------------------- /Project-Costing-Complex/solution/Solution.py: -------------------------------------------------------------------------------- 1 | # Project Costing 2 | 3 | # 4 4 | # 1 5 | # Banking 6 | # 100 7 | # 2 8 | # C 9 | # C++ 10 | # 2 11 | # Finance 12 | # 200 13 | # 3 14 | # C 15 | # C++ 16 | # Java 17 | # 3 18 | # Pharma 19 | # 500 20 | # 4 21 | # C 22 | # C++ 23 | # Java 24 | # Python 25 | # 4 26 | # Transport 27 | # 150 28 | # 1 29 | # Dot Net 30 | # 3 31 | # 200 32 | 33 | class Project(object): 34 | 35 | def __init__(self,projectId,projectName,manHours,technologyList): 36 | self.projectId = projectId 37 | self.projectName = projectName 38 | self.manHours = manHours 39 | self.technologyList = technologyList 40 | self.avgProjectCost = 0 41 | 42 | def calculateProjCost(self,rate_per_manHours): 43 | projectCost = self.manHours * rate_per_manHours 44 | return projectCost 45 | 46 | class Orgination(Project): 47 | 48 | def projectAvgCostByTechnology(projectId,rate_per_manHours,projList): 49 | isMatched = False 50 | for j in projList: 51 | if j.projectId == projectId: 52 | isMatched = True 53 | projCost = j.calculateProjCost(rate_per_manHours) 54 | j.avgProjectCost = projCost / len(j.technologyList) 55 | 56 | print(len(j.technologyList)) 57 | 58 | return [[j.projectId,j.projectName,j.technologyList], j.manHours, j.avgProjectCost] 59 | 60 | if not isMatched: 61 | return None 62 | 63 | n = int(input()) 64 | obj_lis = [] 65 | 66 | for i in range(n): 67 | technologyList = [] 68 | projectId = int(input()) 69 | projectName = input() 70 | manHours = int(input()) 71 | for _ in range(int(input())): 72 | technologyList.append(input()) 73 | obj_lis.append(Project(projectId,projectName,manHours,technologyList)) 74 | 75 | id = int(input()) 76 | rate_per_manHours = int(input()) 77 | 78 | result = Orgination.projectAvgCostByTechnology(id, rate_per_manHours,obj_lis) 79 | 80 | if result == None: 81 | print ("No Project Exist!") 82 | else: 83 | ans_1, ans_2, ans_3 = [ _ for _ in result ] 84 | print(*ans_1,ans_2,ans_3,sep=" ") 85 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Contributors are welcome :) 2 | 3 | Let's help others by adding the latest and recent year-asked questions. 4 | -------------------------------------------------------------------------------- /Salary-Increment-Complex/Question.txt: -------------------------------------------------------------------------------- 1 | Create a class employee with attributes 2 | emp Id, 3 | emp name, 4 | emp role, 5 | emp salary. 6 | 7 | In the same class, define method increment_salary() which takes a 8 | number as an argument, here number represents the percentage by 9 | which the salary should be incremented. 10 | 11 | Create another class Organization with attributes 12 | org_name and 13 | list of employee objects. 14 | 15 | In the same class create a method calculate_salary() which takes 16 | string and number as the input arguments. string input represents 17 | the employee role and the number represents the percentage 18 | by which the salary should be incremented, return a list of 19 | employee objects whose salary has incremented. 20 | 21 | Note: use increment_salary method in this method 22 | 23 | Input: 24 | 25 | 3 26 | 10006 27 | sam 28 | ssd 29 | 10000 30 | 10032 31 | ash 32 | ssd 33 | 20000 34 | 12381 35 | ravi 36 | dev 37 | 40000 38 | ssd 39 | 5 40 | 41 | output- 42 | 43 | sam 44 | 10500.0 45 | ash 46 | 21000.0 47 | -------------------------------------------------------------------------------- /Salary-Increment-Complex/Solution.py: -------------------------------------------------------------------------------- 1 | # Salary Increment 2 | 3 | class Employee: 4 | 5 | def __init__(self,emp_id,emp_name,emp_role,emp_salary): 6 | self.emp_id = emp_id 7 | self.emp_name = emp_name 8 | self.emp_role = emp_role 9 | self.emp_salary = emp_salary 10 | 11 | def increment_salary(self,inc_in_per): 12 | self.emp_salary = (self.emp_salary*(100 + inc_in_per))/100 13 | return self.emp_salary 14 | 15 | class Organization(Employee): 16 | emp_list = [] 17 | 18 | def calculate_salary(role, inc_in_per): 19 | sal_inc_emp = [] 20 | for i in Organization.emp_list: 21 | if i.emp_role == role: 22 | res = i.increment_salary(inc_in_per) 23 | sal_inc_emp.append([i.emp_name, res]) 24 | return sal_inc_emp 25 | 26 | n = int(input()) 27 | emp_lis = [] 28 | 29 | for _ in range(n): 30 | emp_id = int(input()) 31 | emp_name = input() 32 | emp_role = input() 33 | emp_salary = int(input()) 34 | emp_lis.append(Employee(emp_id,emp_name,emp_role,emp_salary)) 35 | 36 | role = input() 37 | inc_in_per = int(input()) 38 | 39 | Organization.emp_list = emp_lis 40 | 41 | result = Organization.calculate_salary(role,inc_in_per) 42 | for i in result: 43 | print(i[0]) 44 | print(i[1]) 45 | -------------------------------------------------------------------------------- /Student-Highest-Marks/Question.txt: -------------------------------------------------------------------------------- 1 | Create a class Student with the below attributes 2 | name of type String 3 | sub1 of type float 4 | sub2 of type float 5 | sub3 of type float 6 | 7 | Create the __init__ method which takes all parameters in the above sequence 8 | 9 | Create a method calculateResult() in the Student class 10 | It checks if the student has scored greater than 40 in all the individual 11 | 3 subjects. If so, it further calculates the average and returns average. 12 | 13 | Create another class School with the below attributes 14 | name of type String 15 | studentDict of type dictionary 16 | 17 | Where key is a Student object and value refers to the result pass or fail 18 | Create the __init__ method which takes all parameters in the above sequence 19 | 20 | Define the two methods getStudentResult and findStudentWithHighestMarks 21 | in this School class 22 | 23 | getStudentResult : This method internaly calls calculateResult method 24 | of Student class to get average. This method checks if the student average 25 | greater than 60 then it updates the student dictionary value as pass. Displays 26 | the names of students who passed. If o student passed print 'No student passed' 27 | 28 | findStudentWithHighestMarks This method accept the list of passed. 29 | Display the name of the highest scored student 30 | 31 | Input: 32 | 33 | 4 34 | Harshit Gupta 35 | 91 36 | 88 37 | 78 38 | Ayush Joshi 39 | 94 40 | 83 41 | 90 42 | Mahi Meena 43 | 95 44 | 87 45 | 90 46 | Yogesh Singh 47 | 41 48 | 42 49 | 41 50 | 51 | 52 | Output: 53 | 54 | List of Passed Students: 55 | Harshit Gupta 56 | Ayush Joshi 57 | Mahi Meena 58 | Student Obtained Maximum Marks: Mahi Meena 59 | -------------------------------------------------------------------------------- /Student-Highest-Marks/solution.py: -------------------------------------------------------------------------------- 1 | class Student: 2 | def __init__(self,name,sub1,sub2,sub3): 3 | self.name = name 4 | self.sub1 = sub1 5 | self.sub2 = sub2 6 | self.sub3 = sub3 7 | 8 | def calculateResult(self): 9 | if self.sub1 > 40 and self.sub2 > 40 and self.sub3 > 40: 10 | avgPer = ((self.sub1 + self.sub1 + self.sub1)/300)*100 11 | return avgPer 12 | else: 13 | return -1 14 | 15 | class School(Student): 16 | 17 | def getStudentResult(obj_lis): 18 | isPass = False 19 | studentLis = [] 20 | for i in obj_lis: 21 | result = i.calculateResult() 22 | if result > 60: 23 | isPass = True 24 | studentLis.append([i.name, result]) 25 | print(i.name) 26 | if not isPass: 27 | print("No student passed") 28 | else: 29 | return studentLis 30 | 31 | def findStudentWithHighestMarks(pass_std): 32 | temp = pass_std[0][1] 33 | for i in pass_std: 34 | if temp < i[1]: 35 | std_name = i[0] 36 | temp = i[1] 37 | return std_name 38 | 39 | n = int(input()) 40 | obj_lis = [] 41 | for i in range(n): 42 | name = input() 43 | sub1 = int(input()) 44 | sub2 = int(input()) 45 | sub3 = int(input()) 46 | obj_lis.append(Student(name,sub1,sub2,sub3)) 47 | 48 | print("List of Passed Students: ") # Additional Lines 49 | res_1 = School.getStudentResult(obj_lis) 50 | print("Student Obtained Maximum Marks: ",end="") # Additional Lines 51 | res_2 = School.findStudentWithHighestMarks(res_1) 52 | print(res_2) 53 | -------------------------------------------------------------------------------- /University-Management-Complex/Question/py1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/University-Management-Complex/Question/py1.jpeg -------------------------------------------------------------------------------- /University-Management-Complex/Question/py2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/University-Management-Complex/Question/py2.jpeg -------------------------------------------------------------------------------- /University-Management-Complex/Question/py3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/University-Management-Complex/Question/py3.jpeg -------------------------------------------------------------------------------- /University-Management-Complex/Question/py5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/University-Management-Complex/Question/py5.jpeg -------------------------------------------------------------------------------- /University-Management-Complex/Question/py6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/University-Management-Complex/Question/py6.jpeg -------------------------------------------------------------------------------- /University-Management-Complex/Question/py7.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/University-Management-Complex/Question/py7.jpeg -------------------------------------------------------------------------------- /University-Management-Complex/Solution/Solution.py: -------------------------------------------------------------------------------- 1 | # University Management Question 2 | 3 | # Test Cases: 4 | 5 | # 4 6 | # 1 7 | # Shivakumar 8 | # 3 9 | # Maths 10 | # 10 11 | # Physics 12 | # 10 13 | # Chemistry 14 | # 10 15 | # 2 16 | # Rajesh 17 | # 4 18 | # MATHS 19 | # 5 20 | # PHYSICS 21 | # 5 22 | # CHEMISTRY 23 | # 5 24 | # COMPUTERS 25 | # 5 26 | # 3 27 | # vasudev 28 | # 2 29 | # MATHS 30 | # 4 31 | # PHYSICS 32 | # 4 33 | # 4 34 | # Srinivas 35 | # 3 36 | # Maths 37 | # 8 38 | # Physics 39 | # 8 40 | # Chemistry 41 | # 8 42 | # 3 43 | # maths 44 | 45 | class Professor: 46 | def __init__(self, profId, profName, subjectsDict): 47 | self.profId = profId 48 | self.profName = profName 49 | self.subjectsDict = subjectsDict 50 | 51 | class University: 52 | def getTotalExperience(lis,id): 53 | exp_lis = [] 54 | isMatched = False 55 | for k in lis: 56 | sum = 0 57 | if k.profId == id: 58 | isMatched = True 59 | for _,v in k.subjectsDict.items(): 60 | sum = sum + v 61 | exp_lis.append(sum) 62 | if isMatched: 63 | return exp_lis 64 | else: 65 | return 0 66 | 67 | def selectSeniorProfessorBySubject(lis,subject): 68 | high_exp = 0 69 | isAvailable = False 70 | for l in lis: 71 | for k,v in l.subjectsDict.items(): 72 | if k.lower() == subject.lower(): 73 | isAvailable = True 74 | if high_exp < v: 75 | high_exp = v 76 | prof_id = l.profId 77 | prof_name = l.profName 78 | prof_subject = l.subjectsDict 79 | if isAvailable: 80 | return [prof_id,prof_name,prof_subject] 81 | else: 82 | return None 83 | 84 | n = int(input()) 85 | lis = [] 86 | for i in range(n): 87 | profId = int(input()) 88 | profName = input() 89 | subjectsDict = {} 90 | for j in range(int(input())): 91 | subject = input() 92 | exp = int(input()) 93 | subjectsDict[subject] = exp 94 | lis.append(Professor(profId,profName,subjectsDict)) 95 | 96 | id = int(input()) 97 | subject = input() 98 | 99 | total_exp = University.getTotalExperience(lis,id)[0] 100 | highest_exp = University.selectSeniorProfessorBySubject(lis,subject) 101 | 102 | print(total_exp) 103 | print(*highest_exp) 104 | -------------------------------------------------------------------------------- /Vowel-String-Simple/Question.txt: -------------------------------------------------------------------------------- 1 | GIVEN some strings in that we need to print the strings which does 2 | not contain more than one vowels in it 3 | 4 | take list of strings as input and create a function vowelString() 5 | that will return list of strings where strings have one or no vowels in it. 6 | 7 | input- 8 | 9 | 3 10 | aeroplane 11 | cfm 12 | art 13 | 14 | output- 15 | 16 | cfm(no vowel) 17 | art(one vowel) 18 | -------------------------------------------------------------------------------- /Vowel-String-Simple/Solution.py: -------------------------------------------------------------------------------- 1 | # Vowels Strings 2 | 3 | def vowelString(lis): 4 | st = 'aeiou' 5 | vowel_lis = [] 6 | for str in lis: 7 | count = 0 8 | for let in str: 9 | if let in st: 10 | count = count + 1 11 | if count <= 1: 12 | vowel_lis.append(str) 13 | return vowel_lis 14 | 15 | lis = [] 16 | for _ in range(int(input())): 17 | lis.append(input()) 18 | 19 | for i in vowelString(lis): 20 | print(i) 21 | -------------------------------------------------------------------------------- /Xplore.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshitgupta028/TCS-Xplore-Python/3a464a844b6863a5ab5233d2538a5fc5c22182a2/Xplore.jpeg --------------------------------------------------------------------------------