- 123
- 82 299
IITM assignment
India
Приєднався 11 кві 2024
Відео
PYTHON | WEEK-8 | GRPA-1,2,3,4 | IITMBS
Переглядів 1,3 тис.День тому
PYTHON | WEEK-8 | GRPA-1,2,3,4 | IITMBS
PYTHON | WEEK-6 | GRPA-1,2,3 | IITMBS
Переглядів 1,7 тис.21 день тому
PYTHON | WEEK-6 | GRPA-1,2,3 | IITMBS
PYTHON | WEEK-5 | GRPA-1,2,3,4,5 | IITMBS
Переглядів 2,4 тис.Місяць тому
PYTHON | WEEK-5 | GRPA-1,2,3,4,5 | IITMBS
PYTHON | WEEK-4 GRPA | 1,2,3,4,5 IITM
Переглядів 1,7 тис.Місяць тому
PYTHON | WEEK-4 GRPA | 1,2,3,4,5 IITM
COMPUTATIONAL THINKING WEEK 3 GRADED ASSIGNMENT #iitm #gradedassignment
Переглядів 302Місяць тому
COMPUTATIONAL THINKING WEEK 3 GRADED ASSIGNMENT #iitm #gradedassignment
PYTHON | WEEK-3 | GRPA 1,2,3,4| IITMBS #iitmbs #python
Переглядів 920Місяць тому
PYTHON | WEEK-3 | GRPA 1,2,3,4| IITMBS #iitmbs #python
STATISTICS -2 | WEEK-3 | GRADED ASSIGNMENT | IITMBS #iitmbs #gradedassignment #stat2
Переглядів 314Місяць тому
STATISTICS -2 | WEEK-3 | GRADED ASSIGNMENT | IITMBS #iitmbs #gradedassignment #stat2
PYTHON | WEEK-3 | GRADED ASSIGNMENT | IITMBS # iitmbs # python
Переглядів 138Місяць тому
PYTHON | WEEK-3 | GRADED ASSIGNMENT | IITMBS # iitmbs # python
MATHEMATICS -2 | WEEK-3 | GRADED ASSIGNMENT | IITMBSC #iitmbsc #iitm
Переглядів 114Місяць тому
MATHEMATICS -2 | WEEK-3 | GRADED ASSIGNMENT | IITMBSC #iitmbsc #iitm
MATHEMATICS-2 | WEEK-2 | GRADED ASSIGNMENT #iitm #maths2 #iitmbsc
Переглядів 141Місяць тому
MATHEMATICS-2 | WEEK-2 | GRADED ASSIGNMENT #iitm #maths2 #iitmbsc
STATISTICS -2 | WEEK-2 | GRADED ASSIGNMENT #iitm #statistics2 # iitmbsc
Переглядів 253Місяць тому
STATISTICS -2 | WEEK-2 | GRADED ASSIGNMENT #iitm #statistics2 # iitmbsc
PYTHON WEEK 2 [ GRPA 1,2,3,4,5 ] #iitm #python
Переглядів 1,8 тис.Місяць тому
PYTHON WEEK 2 [ GRPA 1,2,3,4,5 ] #iitm #python
STATISTICS-I WEEK 2 GRADED ASSIGNMENT #iitm #stat1#gradedassignment
Переглядів 23Місяць тому
STATISTICS-I WEEK 2 GRADED ASSIGNMENT #iitm #stat1#gradedassignment
COMPUTATION THINKING WEEK 2 GRADED ASSIGNMENT #iitm #gradedassignment #coding
Переглядів 22Місяць тому
COMPUTATION THINKING WEEK 2 GRADED ASSIGNMENT #iitm #gradedassignment #coding
MATHEMATICS-I WEEK 2 GRADED ASSIGNMENT #iitm #maths #gradedassignment
Переглядів 172Місяць тому
MATHEMATICS-I WEEK 2 GRADED ASSIGNMENT #iitm #maths #gradedassignment
STATISTICS-2 | WEEK-1| GRADED ASSIGNMENT
Переглядів 4192 місяці тому
STATISTICS-2 | WEEK-1| GRADED ASSIGNMENT
MATHS-2 WEEK-1 GRADED ASSIGNMENT #iitm #iitmadrasbsc
Переглядів 9122 місяці тому
MATHS-2 WEEK-1 GRADED ASSIGNMENT #iitm #iitmadrasbsc
PYTHON WEEK-1 GRPA 1,2,3,4,5 # IITM # iitmadras
Переглядів 7182 місяці тому
PYTHON WEEK-1 GRPA 1,2,3,4,5 # IITM # iitmadras
COMPUTATION THINKING WEEK 1 GRADED ASSIGNMENT #iitm #gradedassignment
Переглядів 272 місяці тому
COMPUTATION THINKING WEEK 1 GRADED ASSIGNMENT #iitm #gradedassignment
MATHEMATICS-I WEEK 1 GRADED ASSIGNMENT #iitm #maths
Переглядів 1122 місяці тому
MATHEMATICS-I WEEK 1 GRADED ASSIGNMENT #iitm #maths
STATISTICS-I WEEK 1 GRADED ASSIGNMENT #iitmadras #gradedassignment
Переглядів 252 місяці тому
STATISTICS-I WEEK 1 GRADED ASSIGNMENT #iitmadras #gradedassignment
MATHS-2 | WEEK-11 | GRADED ASSIGNMENT #iitmbsc # iitm # maths2 #gradedassignment
Переглядів 3383 місяці тому
MATHS-2 | WEEK-11 | GRADED ASSIGNMENT #iitmbsc # iitm # maths2 #gradedassignment
STATISTICS -2 | WEEK-11 | GRADED ASSIGNMENT # iitmbsc # iitmadras # stat2 # graded assignment
Переглядів 913 місяці тому
STATISTICS -2 | WEEK-11 | GRADED ASSIGNMENT # iitmbsc # iitmadras # stat2 # graded assignment
COMPUTATIONAL THINKING WEEK11 GRADED ASSIGNMENT #iitm#ct#coding
Переглядів 1083 місяці тому
COMPUTATIONAL THINKING WEEK11 GRADED ASSIGNMENT #iitm#ct#coding
STATISTICS-I WEEK 11 GRADED ASSIGNMENT #iitmadras #stat1
Переглядів 803 місяці тому
STATISTICS-I WEEK 11 GRADED ASSIGNMENT #iitmadras #stat1
MATHEMATICS-I WEEK 11 GRADED ASSIGNMENT #iitmadras #bs#datascience #maths1
Переглядів 1193 місяці тому
MATHEMATICS-I WEEK 11 GRADED ASSIGNMENT #iitmadras #bs#datascience #maths1
MATHS-2 | WEEK-10 | GRADED ASSIGNMENT #iitmadras #IITMBSc #maths2
Переглядів 6843 місяці тому
MATHS-2 | WEEK-10 | GRADED ASSIGNMENT #iitmadras #IITMBSc #maths2
PYTHON | WEEK-10 | GRADED ASSIGNMENT #iitmbsc #iitm #python
Переглядів 3943 місяці тому
PYTHON | WEEK-10 | GRADED ASSIGNMENT #iitmbsc #iitm #python
bhai ye oppe 2 ka sallybus pata hai kya
❤❤
thanks bro please upload week 9 maths
Already uploaded
Bhai can you post ppa s
Ok, I will post it soon
@@Iitmassignment BHAI JLDI UPLOAD KRDE BHAI
@@Iitmassignment bro jkldi upload krdo
ppa graded hai kya ouski due date toh 31 dex. show kr rhi hai
btw ouski due date 31 dec. show kr rhi hai
Is this all correct
Guys 3rd code run nahi horaha output your function is not recursive batharaha h
@@dreamer__1418 In my assignment it's displaying all private5/5 and public3/3 case passed.Please test run your code for one more time.
Thanks again man😅
GRPA-1 def reverse(L): if len(L) <= 1: return L # Bring the last element to the front # And reverse the first n - 1 elements return [L[-1]] + reverse(L[:-1]) GRPA-2 def linear(P, Q, k): if len(P) != len(Q): return False if len(P) == 0: return True if P[0] / Q[0] != k: return False return linear(P[1: ], Q[1: ], k) GRPA-3 def collatz(n): # base case of the recursion # if n = 1, you don't need to call the function at all if n == 1: return 0 # simple application of the piecewise defn of the # Collatz function if n % 2 == 0: return 1 + collatz(n // 2) else: return 1 + collatz(3 * n + 1) GRPA-4 def steps(n): if n == 1: return 1 if n == 2: return 2 if n == 3: return steps(1) + steps(2) + 1 return steps(n - 1) + steps(n - 2) + steps(n - 3) GRPA-5 def ancestry(P, present, past): if present == past: return [past] return [present] + ancestry(P, P[present], past)
Bhai code de de bhai
Bha code plse
5 minutes
Yes code plz
Bro please comment the code
Ok wait
pls comment the code
ok wait for 5 minutes
Bhai code please😊😅
ok
bro please comment the codes!
@@JitarthDevalia ua-cam.com/video/HTux8sKl-jM/v-deo.htmlfeature=shared
Bro can you copy the codes and paste in the comment section
bhai week 9
Will upload it within a hour
can you please comment the grpa's?
yes please
@@shreyamagar16 THIS GRPA IS OF MAY 2024 TERM I HAVE UPLOADED THE GRPA OF SEP TERM
Last two questions??
bhai please math 2 week 8 ga please
@@GAURAVGUPTA-h6s ua-cam.com/users/shorts_D21_jinPeI?feature=shared
GRPA-1 def get_freq(filename): f = open(filename, 'r') freq = dict() for line in f: word = line.strip() if word not in freq: freq[word] = 0 freq[word] += 1 f.close() return freq GRPA-2 def relation(file1, file2): """ Determine the relationship between two files Arguments: file1, file2: strings, paths to two files Return: string: 'Equal', 'Subset' or 'No Relation' """ with open(file1, 'r') as f1, open(file2, 'r') as f2: lines1 = [line.strip() for line in f1] lines2 = [line.strip() for line in f2] if lines1 == lines2: return 'Equal' elif all(line in lines2 for line in lines1): return 'Subset' else: return 'No Relation' GRPA-3 def get_goals(filename, country): f = open(filename, 'r') # Ignore the header f.readline() nplayers, ngoals = 0, 0 for line in f: # Unpacking a list into three variables player, country_file, goals = line.split(',') if country_file == country: nplayers += 1 ngoals += int(goals) f.close() if nplayers > 0: return (nplayers, ngoals) return (-1, -1) GRPA-4 def num_to_words(mat): P = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'} f = open('words.csv', 'w') n = len(mat) for i in range(n): for j in range(n): line = f'{P[mat[i][j]]}' # do not add a comma for the elements in the last column if j != n - 1: line += ',' f.write(line) # go to the next line as long as you are not in the last line if i != n - 1: f.write(' ') f.close()
👍
👍👍
Thank you
Welcome!
Thanks bro
😇😇😇
bhai tussi great ho 🤩
😂😂😂
@@Iitmassignment yes u are great bro
thank uu
GRPA-3 def minor_matrix(M, i, j): """ Calculate the minor matrix M_ij by removing the ith row and jth column of M. Args: M (list of lists): Square matrix. i (int): Row index to remove (zero-based). j (int): Column index to remove (zero-based). Returns: list of lists: Minor matrix M_ij. """ # Remove ith row minor_M = [row for index, row in enumerate(M) if index != i] # Remove jth column minor_M = [row[:j] + row[j+1:] for row in minor_M] return minor_M GRPA-4 station_dict = {} n = int(input()) # Number of trains for _ in range(n): train_name = input() # Train name m = int(input()) # Number of compartments compartment_dict = {} for _ in range(m): compartment, passengers = input().split(',') compartment_dict[compartment] = int(passengers) station_dict[train_name] = compartment_dict
GRPA-1 #Initialize dictionary to store team wins team_wins = { 'CSK': 0, 'DC': 0, 'KKR': 0, 'MI': 0, 'PK': 0, 'RR': 0, 'RCB': 0, 'SH': 0 } #Read match outcomes for _ in range(8): teams = input().split(',') winner = teams[0] team_wins[winner] += len(teams) - 1 #Sort teams by wins and name sorted_teams = sorted(team_wins.items(), key=lambda x: (-x[1], x[0])) #Print IPL points table for team, wins in sorted_teams: print(f"{team}:{wins}") GRPA-2 def merge(D1, D2, priority): """ Merge two dictionaries D1 and D2 based on priority. Args: D1 (dict): First dictionary. D2 (dict): Second dictionary. priority (str): Priority for common keys, either "first" or "second". Returns: dict: Merged dictionary. """ if priority == "first": merged_dict = D1.copy() merged_dict.update({key: value for key, value in D2.items() if key not in merged_dict}) elif priority == "second": merged_dict = D2.copy() merged_dict.update({key: value for key, value in D1.items() if key not in merged_dict}) else: raise ValueError("Invalid priority. It should be either 'first' or 'second'.") return merged_dict
thanks a lot
As soon as possible
thank yu so much for your help
Glad it helped
bro you are the best,thanks for helping us
Happy to help
Can you please upload for week 7 and 8 as well
Ok I will upload today
@Iitmassignment thankyou
GRPA-3 def is_num_sorted(num)->bool: ''' Check if a number is sorted. sorted means the digits of a number are sorted in ascending order. Eg. 1468 - sorted , 4948 - not sorted. Argument: num: int Return: bool ''' num_str = str(num) num_str_sorted = "".join(sorted(list(num_str))) return num_str == num_str_sorted def sorted_num_count(nums:list) -> int: ''' Given a list of nums(int) find the count of sorted numbers in the list. Arguments: nums - list[int] Return: count - int ''' return len(list(filter(is_num_sorted, nums))) # another approach - can also use comprehensions # return sum(map(well_behaved, nums)) # sum of boolean will be the count def common_substring(words:list)->str: ''' Given a list of words check whether there is a word in words that is a substring of all other words. If there is a word return that word else return None Hint: only the smallest word can be a substring of all other words. Arguments: words - list[str] Return: common_substr_word - str ''' min_word = min(words, key = len) # check if min_word in word for all word in words if all(map(lambda word : min_word in word, words)): return min_word # another approach using comprehensions # if all(min_word in word for word in words): # return min_word def is_valid_phone_number(phone_no:int)->bool: ''' Check if a number is valid for a specific operator. A phone number is valid if - it has 10 digits - should begin with 98123 - same digit should not occur more that 5 times. ''' phone_no_str = str(phone_no) # note that the below return statement is a single experssion return ( len(phone_no_str) == 10 # has 10 digits and phone_no_str[:5] == "98123" # begins with 98123 and all(phone_no_str.count(str(digit))<=5 for digit in range(0,10)) # check if all the numbers are present less than 5 times ) def validate_phone_numbers(phone_nos:list)->dict: ''' Given a list of phone numbers, create a dict with phone numbers as keys and the string "VALID" or "INVALID" depending on the validity of the phone number as described by the above funtion. Arguments: phone_nos - list Return: validity_dict - dict[int,str] ''' return { number: "VALID" if is_valid_phone_number(number) else "INVALID" for number in phone_nos } def get_election_winner(votes:dict)->str: ''' Given a dictionary with candidate name as key and number of votes as values, Find the winner of the election who has the maximum votes Arguments: votes - dict[str, int] Return: winner - str ''' return max(votes, key = votes.get) def misspelt_words(vocab:str, sentence:str)->list: ''' Given a comma separated string of vocabulary, and a space separated string sentence, return a list of misspelt words in the order they occur in the sentence. The words which are not in the vocabulary are considered misspelt. Arguments: vocab - str: comma separated string with vocabulary sentence - str: space separated string of sentence Return: misspelt_words - list ''' vocab, words = set(vocab.split(",")), sentence.split() return [word for word in words if word not in vocab] # another approach # return list(filter(lambda x: word not in vocab, words)) def count_sock_pairs(sock_colors:list)->int: ''' Given a list of sock colors representing the color of each sock, find the number of sock pair (both having same color) is there. Eg. ["red","blue","green","green","red","green","red","red","blue","black"] 2 red+ 1 green+ 1 blue = 5 pairs Arguments: sock_colors - list: of sock colors Return: number of pairs of sock - int ''' sock_counts = {} # count socks of each color for color in sock_colors: if color not in sock_counts: sock_counts[color] = 0 sock_counts[color] += 1 # use floor division to find the number of sock pairs return sum(count//2 for count in sock_counts.values()) def is_vowely(word:str)->bool: ''' Check if a given word is vowely. A word is vowely if - it has all the vowels in it. - the vowels occur in ascending order. Assume no letter repeats in the given word. Eg. abecidofu - vowely, tripe - not vowely, eviaoqu - not vowely Argument: word - a string with no letter repeated Return: bool Hint: if the non-vowels are removed from the word, it would be just aeiou ''' return "".join(char for char in word if char in "aeiou" ) == "aeiou" # alternate approach using filter # return "".join(filter(lambda char: char in "aeiou", word)) == "aeiou" def vowely_count(words:list)->int: ''' Given a list of words find the number of vowely words from the list. Arguments: words :list[str] Return: int - number of vowely words ''' return len(list(filter(is_vowely, words))) def format_name(first:str, middle:str, last:str)->str: ''' Given three lower case parts of name, return the full name with first letter capitalized in each part. Note that middle name can be empty. ''' first, middle, last = map(str.title, (first, middle, last)) return f"{first} {middle} {last}" if middle else f"{first} {last}" def double_palindromes(n:int)->list: ''' Given a number n, find all the positive integers till n (including) that are double_palindrome. A number is double palindrome if it is a palindrome and its square is a palindrome. Eg. 8 - palindrome, not double palindrome 11 - palindrome and double palindrome 12 - not palindrome and not double palindrome Arguments: n - int: range of numbers to search Return: list of integers which are double palindrome in the ascending order ''' def is_palindrome(n): n_str = str(n) return n_str==n_str[::-1] return list(filter(lambda x: is_palindrome(x) and is_palindrome(x**2), range(1,n+1))) # alternate approach using comprehensions ''' return [ num for num in range(1,n+1) if is_palindrome(x) and is_palindrome(x**2) ] ''' def scores_spx(kakashi_moves:list, guy_moves:list): ''' Given the series of moves played by Kakashi and Guy in a Stone-Paper-Scissor game, find the scores of Kakashi and guy respectively. Rules - Stone beats Scissor, Scissor beats Paper and Paper beats Stone Score - Number of times won Symbols - Stone - S, Paper - P, Scissor - X Arguments: kakashi_moves and guy_moves - list of moves where each move is a string corresponding to the symbol Return: kakashi_score:int , guy_score:int ''' wins = [('S','X'), ('X','P'),('P','S')] k_score, g_score = 0,0 for k, g in zip(kakashi_moves, guy_moves): if (k,g) in wins: k_score+=1 elif (g,k) in wins: g_score+=1 return k_score, g_score
GRPA-2 import random # heterogenous values in multiple lines def display_student_details(name:str, age:int, rollno:int): ''' Given name, age, and rollno of student, print them over multiple lines Output format: name age rollno Return: None ''' print(name) print(age) print(rollno) # heterogeneous values - single line def display_student_details_same_line(name:str, age:int, rollno:int): ''' Given name, age, and rollno of student, print them in the same line separated by a comma. Output format: name,age,rollno ''' print(name,age,rollno,sep=",") # homogeneous - single line def display_comma_separated_integers(nums:list): ''' Given a list of nums print them in the same line separated by commas. For example, if nums= [1,3,4,5], Output format: 1,3,4,5 ''' print(*nums, sep=",") # homogeneous - multi-line - definite def display_float_nums_over_multiple_lines(nums:list): ''' Given a list of floating point nums print them over multiple lines with 3 digits after the decimal point. For example, if nums = [1.2, 3.4,5.6,7.8] Output format: 1.200 3.400 5.600 7.800 ''' print(*[f"{num:.3f}" for num in nums], sep=" ") # homogeneous - indefinite def display_random_ints(seed:int): ''' Given a random seed, set the random seed and generate multiple random integers within the range [0,100] (using `randint(0,100)`), until 0 is encountered and print it with max 10 comma seperated ints per line over multiple lines Output format 34,26,73,82,35,36,7,4,27,46 6,33,62,78,0 ''' random.seed(seed) i = 0 while True: i+=1 num = random.randint(0,100) if num ==0: print(num) break if i%10==0: print(num) continue print(num,end=',') # hybrid - single line def display_batsman_runs(name:str, number:int, runs:list): ''' Given name, number and runs scored by a batsman display the name, number and runs separated by commas in the same line. For example, if name="player1", number=9 and runs=[2,3,4,4,6] Output Format; player1,9,2,3,4,4,6 ''' print(name, number, *runs, sep=",") # key value def display_course_scores(course_scores:dict): ''' Given a dictionary of course scores with course name as keys and course scores as values. Format each course score pair separated by colon(':') on each line where each pair is printed over multiple lines in the ascending order of keys. For example, if course_scores = {"course1":78, "course3":89,"course2":90} Output format: course1:78 course2:90 course3:89 ''' for course, score in sorted(course_scores.items()): print(f"{course}:{score}") # alternate solution # print(*(f"{course}:{score}" for course, score in sorted(course_scores.items())),sep=" ") def display_all_batsman_runs(batsman_runs:list): ''' Given a list of tuple of batsman runs, print the batsman name and comma separated runs which are separated by a hyphen and printed over multiple lines. Arguments: batsman_runs: list[tuple(str, list[int])] For example, if batsman_runs = [ ("batsman1",[1,2,1,4,6,2,2,1]), ("batsman2",[2,2,6,4,1]), ("batsman3",[6,1,2,4,4,2]) ] Output format: batsman1-1,2,1,4,6,2,2,1 batsman2-2,2,6,4,1 batsman3-6,1,2,4,4,2 ''' for batsman, runs in batsman_runs: print(batsman, end="-") print(*runs,sep=",") # alternate way ''' for batsman, runs in batsman_runs: print(f"{batsman}-{','.join(map(str,runs))}") ''' def display_student_marks(student_marks:list): ''' Given the student rollno, city, age and marks of course1, course2 and course3 as a list of dicts, print the attributes of each student in a single line as comma separated values (in the previously mentioned order) and print the whole list over multiple lines. Arguments: student_marks: list[dict] where the keys of the dict are 'rollno':int,'city':str, 'age':int, 'course1':int, 'course2':int,'course2':int For example, if student_marks = [ {'rollno': 1, 'city': 'chennai', 'age': 23, 'course1': 86, 'course2': 69, 'course3': 86}, {'rollno': 2, 'city': 'mumbai', 'age': 19, 'course1': 78, 'course2': 65, 'course3': 89} ] Output: 1,chennai,23,86,69,86 2,mumbai,19,78,65,89 ''' attrs = ['rollno','city','age','course1','course2','course3'] for student in student_marks: print(*(student[attr] for attr in attrs), sep=",") def display_student_marks_over_multiple_lines(student_marks:list): ''' Same input as the above function, but print each attribute over mulitple line in the same order of attributes as the previous one. For the example given in the above input, Output: 1 chennai 23 86 69 86 2 mumbai 19 78 65 89 ''' attrs = ['rollno','city','age','course1','course2','course3'] for student in student_marks: print(*(student[attr] for attr in attrs), sep=" ") # this basically reads the input and executes it as code import sys exec(sys.stdin.read())
GRPA-1 # heterogeneous - multi line def get_student_details(): ''' Get the student details over multiple lines Input format: name age rollno Return: name:str, age:int, rollno:int ''' name, age, rollno = input(), int(input()), int(input()) return name, age, rollno # heterogeneous - single line def get_student_details_same_line(): ''' Get the student details from the same line Input format:(separated by space) name age rollno Return: name:str, age:int, rollno:int ''' name, age, rollno = input().split() age, rollno = int(age), int(rollno) return name, age, rollno # homogeneous - single line def get_comma_separated_integers(): ''' Get a list of comma separated integers from input Return: numbers:list[int] ''' numbers = list(map(int, input().split(","))) # another approach using comprehensions # numbers = [int(num) for num in input().split(",")] return numbers # homogeneous - multi-line - definite def get_n_float_numbers(): ''' Get n float numbers with one number in each line and the first line has n. Input Format: n num1 num2 ... numn Return: nums:list[float] ''' n = int(input()) nums = [float(input()) for i in range(n)] return nums # homogeneous - multi-line - indefinite def get_nums_until_end(): ''' Get float numbers with one number in each line until the input is "end"(case insensitive) Input Format: num1 num2 ... numx End Return: nums:list[float] ''' nums = [] while True: num = input() if num.lower() == "end": break nums.append(float(num)) return nums # hybrid - single line def get_batsman_runs(): ''' Get batsman name, number and runs as a list Input format: (separated by space) name no run1 run2 run3 ... Return: name:str, no:int, runs:list[int] ''' name, no, *runs = input().split() no = int(no) runs = list(map(int, runs)) return name, no, runs # key value def get_course_scores(): ''' Get course name and scores of the over multiple lines where course name and scores are separated by a hypen in each line. First line corresponds to the number or entries. Input format: 2 course1-score1 course2-score2 Return: dict[str,int] - with course name as key and score as value ''' n = int(input()) course_scores = [input().split('-') for i in range(n)] # split each line using '-' # create the dictionary using comprehensions course_scores = {course:int(score) for course, score in course_scores} return course_scores # dict with list as values def get_all_batsman_runs(): ''' Given the batsman name and the comma separated runs where both are seperted by a hypen in multiple lines, create a dictionary with batsman name and list of runs as value. The number of lines is given in the first line Input format: 3 batsman1-1,2,1,4,6,2,2,1 batsman2-2,2,6,4,1 batsman3-6,1,2,4,4,2 Return: dict[str,list[int]] - with batsman name as key and list of runs as values ''' n = int(input()) batsman_runs = [input().split('-') for i in range(n)] # split name and runs using '-' batsman_runs = { name:list(map(int, runs.split(','))) # split runs by ',' and map to int for name, runs in batsman_runs } return batsman_runs # csv - list of dicts def get_student_marks(): ''' Given the student rollno, city, age, course1_marks, course2_marks and course3_marks as comma separated values over multiple lines, create a list of dict with the above attributes as keys and the corresponding value as values. The number of lines is given in the first line Input Format: n 1,citya,23,86,69,86 2,cityb,19,78,65,89 ... n,cityx,35,89,57,76 Return: student_data - list[dict]: where each dict would be {'rollno':int, 'city':str,'age':int, 'course1':int, 'course2':int, 'course3':int} ''' n = int(input()) student_data = [] for i in range(n): rollno, city, age, course1, course2, course3 = input().split(',') rollno,age, course1, course2, course3 = map(int, [rollno,age, course1, course2, course3]) student_data.append({ "rollno":rollno, "city":city, "age":age, "course1":course1, "course2":course2, "course3":course3, }) return student_data # list of dicts def get_student_data_over_multiple_lines(): ''' Given each attribute as described above in given over multiple lines and multiple entries are given create a dictionary as described above. Input format: n 1 citya 23 86 69 86 2 cityb 19 78 65 89 ... n cityx 35 89 57 76 ''' student_data = [ { "rollno":int(input()), "city":input(), "age":int(input()), "course1":int(input()),"course2":int(input()),"course3":int(input()), } for i in range(int(input())) ] return student_data # this will read the function name from the input. func = eval(input()) # this will read the actual output that is required which is the second line expected_output = eval(input()) # The remaining of the input should be read by your function actual_output = func() if expected_output != actual_output: print("Your output doesn't match the expected output.") print(actual_output)
Kal last date hai
Bhai yaar code comment me paste kardo please bohot help ho jayegi
Bhai kar dena yaar 2 min lagege
Check comment
@@Iitmassignment thankyou you so much bro ❤️
Hlw bhai code comment kr dete please
Ok will do it soon
Krdo please@@Iitmassignment
Check comment
Check comment
thanks bro can we connect personally
Yeah please keep posting, it really really helps a lot💞
Will do!
Thank you 👍
thank you so much bro🙏🙏🙏🙏🙏🙏 due to dual degree i did not able to get time to these assignments thank you bro
Always welcome
Bro... I'm trusting all ur answera....hope all are correct 🥲🥲🥲😅
I hope so too😂😂
@Iitmassignment 😂
add my hopes too 😂
How ru getting this answers, where did u learn python this deep? Help me please 🥺
Thanks Bhai so mucchhh😮
Thanks Bro! Are you in Foundation level?
No
Thanks a lot bhai
Thanks
keep posting these please, it helps a lot