[Solved] Given a non-empty list of strings of the same length, how do I create a list of lists of the letters at each position in the string without using zip? [closed]

Given a non-empty list of strings of the same length, how do I create a list of lists of the letters at each position in the string without using zip? [closed] solved Given a non-empty list of strings of the same length, how do I create a list of lists of the letters at each … Read more

[Solved] calculate and return the difference between the second largest number and the second smallest number [closed]

Here is a simple, but not most efficient way. you can achieve that by two step: convert list to set, to remove the duplicate number. use heap to find nlargest and nsmallest in set def difference(list1): set1 = set(list1) return heapq.nlargest(2, set1)[1] – heapq.nsmallest(2, set1)[1] Here is a one pass way, more efficient way, use … Read more

[Solved] Nested list doesn’t work properly

I think the problem is the assignment equation = eqn. Since eqn is a list, it is a mutable and thus passed as a reference, when you assign a mutable, the variable actually contains a pointer to that object. This means that equation and eqn are the same list. You should from copy import deepcopy … Read more

[Solved] I have given nested list accessing via for loop, but I can’t getting result?

patientsList = [[‘sagar’,’9856782311′],[‘mahsh’,’7865423158′]] search = input(“Enter mobile number of patient to search: “) for patient in patientsList: ”’ patient looks like this [‘sagar’,’9856782311′] patient[0] is the name patient[1] is the phone number ”’ if search == patient[1]: print(“Required patient is”) print(patient) print(“is Appointed”) break 9 solved I have given nested list accessing via for loop, … Read more