Lecture5 List and Dictionary comprehensions

Take home Question

Problem 1

  1. Find the domain name from url
    url = 'www.abrakadabra.com/dccEcB/EGdd'
  2. Then make use of unique function that we wrote in last lecture def unique(items): unique_items = [] for item in items:
     if item not in unique_items:
         unique_items.append(item)
    
    return unique_items

Question find prime numbers less than 100

Some rules for good python programming

  1. Give very sensible names to variables and function
  2. Decompose your problem well
  3. To do , try to explaon your problem in plain english to a non programmer.
  4. write small function and compose them together

list slicing

items[start:end:step]

Question