def unique_count(lst):
ul = []
for i in lst:
if i not in ul:
ul.append(i)
return len(ul)

Complete in python The function unique_count returns the number of unique items in its parameter, lst,...
#We've written the function, sort_with_bubbles, below. It takes #in one list parameter, lst. However, there are two problems in #our current code: # - There's a missing line # - There's a semantic error (the code does not raise an # error message, but it does not perform correctly) # #Find and fix these problems! Note that you should only need #to change or add code where explicitly indicated. # #Hint: If you're stuck, use an example input list and...
Python. Write a function that takes in a list and returns the first nonzero entry. def nonzero(lst): """ Returns the first nonzero element of a list >>> nonzero([1, 2, 3]) 1 >>> nonzero([0, 1, 2]) 1 >>> nonzero([0, 0, 0, 0, 0, 0, 5, 0, 6]) 5 """ "*** YOUR CODE HERE ***"
How to do this code?
HW13.11. Create an HTML list from a Python list The function below takes one parameter: a list, that contains only strings. Complete the function to create a unordered HTML list, as a string, and returns it. An empty list should return an empty HTML list with no list items. Do not add any extraneous whitespace to the HTML. For example, if given the list ["one", "two"], the function should return "<ul><li>one</li><li>two</li> </ul>". student.py IT TI...
Python3: Write the function findLongestStreak(lst) which takes a list of numbers, lst, and returns the longest streak of numbers which occur in the list. A streak of numbers is a list of numbers where each number is one greater than the one that occurred before it- for example, [4, 5, 6, 7]. So findLongestStreak([3, 4, 8, 2, 3, 4, 5, 7, 8, 9]) would return [2, 3, 4, 5]. If there is more than one streak with the longest length,...
In Python, Complete the extraCreditTotal() function to take a list of grades as a parameter and return the total number points above 100. Examples: extraCreditTotal( [101, 83, 107, 90] ) returns 8 (because 1 + 0 + 7 + 0 is 8) extraCreditTotal( [89, 113, 95] ) returns 13 extraCreditTotal( [89, 73, 96, 97, 99, 100] ) returns 0
1. use python List to Dictionary Write a function that has three parameters: a list of unsorted numbers with no duplicates, a start number, and an end number. This function should return a dictionary with all integers between the start and end number (inclusive) as the keys and their respective indices in the list as the value. If the integer is not in the list, the corresponding value would be None. Example unsorted list: [2,1,10,0,4,3] two numbers: 3, 10 returned...
Python help! Any help is appreciated, thank you! Fill in the missing function, monthString(), in the program. The function should take number between 1 and 12 as a parameter and returns the corresponding month as a string. For example, if the parameter is 1, your function should return "January". If the parameter is 2, your function should return out "February", etc. def monthString(monthNum): """ Takes as input a number, monthNum, and returns the corresponding month name as a string. Example:...
In Python Complete the function powersOf5(). Have the function take a parameter n and return a list of the first n powers of 5. One way to calculate powers of 5 is by starting with 1 and then multiplying the previous number by 5. Examples: powersOf5( 1 ) returns [1] powersOf5( 2 ) returns [1, 5] powersOf5( 3 ) returns [1, 5, 25] powersOf5( 6 ) returns [1, 5, 25, 125, 625, 3125] powersOf5( 10 ) returns [1, 5, 25,...
Using PYTHON: (Find the index of the smallest element) Write a function that returns the index of the smallest element in a list of integers. If the number of such elements is greater than 1, return the smallest index. Use the following header: def indexOfSmallestElement(lst): Write a test program that prompts the user to enter a list of numbers, invokes this function to return the index of the smallest element, and displays the index. PLEASE USE LISTS!
The function below takes a single parameter, a list of numbers called number_list. Complete the function to return a string of the provided numbers as a series of comma separate values (CSV). For example, if the function was provided the argument [22, 33, 44], the function should return '22,33,44'. Hint: in order to use the join function you need to first convert the numbers into strings, which you can do by looping over the number list to create a new...