AquaBlitz11

Gunn coding Jan 31, 2021

Feb 1st, 2021 (edited)
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. # A. Find
  2.  
  3. Given a list of strings L (hardcoded) and a string s (user input), find whether s is in L and report to the screen.
  4.  
  5. For example, if L = ['python', 'cpp', 'java'], if user inputs 'c', you should print "Not in the list."
  6.  
  7. Hint: Similar to prime checking (Use flag variable).
  8.  
  9. # B. Bubble Sort
  10.  
  11. Given a list of numbers L, sort L in increasing order and print L.
  12. For example, if L = [5, 2, 4, 1, 8, 3], you should output [1, 2, 3, 4, 5, 8].
  13.  
  14. One popular algorithm for sorting is called "Bubble Sort."
  15. - You make n-1 "passes" through the array.
  16. - In each pass, you look at each adjacent pair of numbers. If the left number is greater than the right number, swap.
  17.  
  18. See the following video for algorithm visualization (Loud sound warning):
  19. https://www.youtube.com/watch?v=Cq7SMsQBEUw
  20.  
  21. # C. Intersection
  22.  
  23. Given two lists L1 and L2, generate a list L3 which is the intersection of L1 and L2. You may assume L1 and L2 each has no duplicate elements. Any ordering in L3 is fine. (So, L1, L2, L3 act like sets.)
  24.  
  25. For example, if L1 = [3,2,7,6,8] and L2=[1,2,3,4,5], one possible output is [3,2].
  26.  
  27. Hint: You will need to use problem A as a subroutine in your program.
  28.  
  29. # D. Statistics
  30.  
  31. Given a list of numbers L, output the minimum, maximum, mean, median, mode.
  32.  
  33. If you can only do min/max/mean, that's fine. Median and mode require some insights.
Add Comment
Please, Sign In to add comment