Courses‎ > ‎Intro to CS - Full Year‎ > ‎Spring‎ > ‎Dyrland-Weaver‎ > ‎Work‎ > ‎

Work 23: 4/1

posted Apr 1, 2019, 10:52 AM by JonAlf Dyrland-Weaver   [ updated Apr 1, 2019, 11:39 AM ]
Write the following python functions
  • random_list
    • Takes 2 parameters (n, limit).
    • Returns a list of n random integers in the range [0, limit)
  • bar_graph:
    • Takes a list of non-negative integer values and returns a string of a bar graph representation of the data.
    • Example:
      • a = [9, 5, 5, 3, 1, 5, 9, 5, 7, 8]
      • print(bar_graph(a))
      • 0: =========
      • 1: =====
      • 2: =====
      • 3: ===
      • 4: =
      • 5: =====
      • 6: =========
      • 7: =====
      • 8: =======
      • 9: ========
  • find_mode:
    • Takes a list of values and returns the value that appears most often (the mode).
    • If there are multiple modes, returning any of them will suffice.
submit this as lists_1
Comments