Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1. Create an empty list and assign it to the variable "empty"
- #solution
- empty = []
- #2. Create a list with a single Boolean - True - and assign it to the variable "active"
- #solution
- active = [True]
- #3. Create a list with 5 integers of your choice and assign it to the variable "favourite_numbers"
- #solution
- favourite_number = [14, 5, 94, 60, 99]
- #4. Create a list with 3 strings - "red", "green", "blue" - and assign it to the variable "colors"
- colours = ["red", "green", "blue"]
- #5. Declare an is_long function that accepts a single list as an argument
- # It should return True if the list has more than 5 elements, and False otherwise
- #solution
- def is_long(array):
- if len(array) > 5:
- print(True)
- else:
- print(False)
- is_long([1,6,8,9,56,43,5])
- is_long(favourite_number)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement