1 pythonCopyl = [] # empty list
2l = [2, 4, 6, 8] # elements of same data type
3l = [2, 'Python', 1+2j] # elements of different data type
4
1#creating a list
2create_list = ["apple", "banana", "cherry"]
3print(create_list)
1#creating a list in python, and using it to find if the minute right now is odd or even number.
2
3from datetime import datetime #importing a function from a module
4
5import random
6import time
7
8odds= [3,5,7,9,11,13,15,17,19,21,23, #variable with a list inside it
9 25,27,29,31,33,35,37,39,43,43,
10 45,47,49,51,53,55,57,59]
11
12for i in range(5): #start at 0 and loop 5 times
13
14 right_this_minute=datetime.today().minute #variable to store the minute
15
16 if right_this_minute in odds:
17 print ("time is odd number") #if/else statement (conditional statements)
18
19 else:
20 print("time is even number")
21
22 wait_time = random.randint(1,60) #generate a random integer and store it in that variable
23 time.sleep = wait_time #use the generated variable to sleep for that certain period
24print() #print a blank line