Python Quiz - Lists, Set and Dictionary comprehension

less than 1 minute read

Task 1

  • create two lists containing 30 random values between 1 and 100.
  • return a list of all number which are present in both lists.

Task 2

  • create 20 lists of 30 random values between 1 and 100.
  • return the number of lists which contain:
    • only numbers >2
    • at least one number <2

Task 3

  • create a dictionary which assigns to every letter of the String webLyzard a random number between 1 and 100.

Required Functions

from random import randint
def rnd():
    return randint(1,100)

Proposed Solution

Proposed Solution

Python Tips, Tricks, and Hacks

Leave a comment