Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """ This section tests your level of understanding with List """
- # The first three following statements address the declaration
- # of list objects and assignment to suitable variables
- active = [True]
- favorite_numbers = [23, 3, 33, 59, 8]
- colors = ["red", "green", "blue"]
- #Invocation of the Variables
- print(active)
- print(favorite_numbers)
- print(colors, "\n")
- # This function called is_long() determines the length of a list argument
- # Thereby returning Boolean True for a length greater than 5 and False otherwise
- def is_long(size):
- if len(size) > 5: # Stating the condition
- return True
- else:
- return False
- print(is_long([3, 5, 6, 9])) # The length is 4 = False
- print(is_long([3, 5, 6, 9, 56])) # The length is 5 = False
- print(is_long([3, 5, 6, 9, 4, 2])) # The length is 6 = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement