SHARE
TWEET

Untitled

a guest Feb 21st, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #1. Create an empty list and assign it to the variable "empty"
  2. #solution
  3.  
  4. empty = []
  5.  
  6. #2. Create a list with a single Boolean - True - and assign it to the variable "active"
  7. #solution
  8.  
  9. active = [True]
  10.  
  11. #3. Create a list with 5 integers of your choice and assign it to the variable "favourite_numbers"
  12. #solution
  13.  
  14. favourite_number = [14, 5, 94, 60, 99]
  15.  
  16. #4. Create a list with 3 strings - "red", "green", "blue" - and assign it to the variable "colors"
  17.  
  18. colours = ["red", "green", "blue"]
  19.  
  20. #5. Declare an is_long function that accepts a single list as an argument
  21. # It should return True if the list has more than 5 elements, and False otherwise
  22. #solution
  23.  
  24. def is_long(array):
  25.     if len(array) > 5:
  26.         print(True)
  27.     else:
  28.         print(False)
  29.    
  30. is_long([1,6,8,9,56,43,5])
  31. is_long(favourite_number)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top