- from Song import Song
- def print_array(my_list, action):
- for i in range(len(my_list)):
- print("I " + action + " a " + my_list[i] + ".")
- my_fruit = ["apple", "banana", "orange", "kiwi", "pear"]
- # print(len(my_fruit))
- # print(my_fruit)
- # print_array(my_fruit, "eat")
- my_fruit[1] = "grape"
- # print_array(my_fruit, "eat")
- #
- # print(my_fruit[5])
- # print(len(my_fruit))
- # my_fruit[5] = "watermelon"
- #
- # print(my_fruit[5])
- # ["apple", "banana", "orange", "kiwi", "pear"]
- # my_fruit.append("mango")
- # my_fruit = ["apple", "banana", "orange", "kiwi", "pear", "mango"]
- # print_array(my_fruit, "eat")
- # print(my_fruit.pop())
- # print_array(my_fruit, "ate")
- my_fruit.insert(0, "peach")
- # print_array(my_fruit, "will eat")
- # print_array(my_fruit, "didn't eat")
- def print_song(track, playlist):
- print("Song: " + playlist[track][0] )
- print("Artist: " + playlist[track][1])
- def print_playlist(playlist):
- for song in range(len(playlist)):
- print_song(song, playlist)
- songs = [["Hello", "Adele"], ["Lithium", "Nirvana"]]
- songs.append(["Dance", "Drake"])
- songs.append(["Happy", "Pharrell"])
- # print_song(2, songs)
- # print_playlist(songs)
- # print(songs[1][1])
- my_song = Song("Dynamite", "BTS")
- # print(my_song)
- # my_function()
- def print_add(a, b):
- # stuff in the middle
- # aka the BODY of the function
- print(a + b)
- # print_add(5, 7)
- my_string_with_number = "hello CSIT 111"
- my_string_no_number = "ccbc is a school"
- def remove_spaces(input_string: str):
- filter = input_string.replace(" ", "")
- return filter
- # print(my_string_with_number.isalpha())
- print(my_string_no_number)
- print(remove_spaces(my_string_no_number))
- checking_this = remove_spaces(my_string_no_number)
- print(checking_this.isalpha())
- condition = True
- counter = 0
- while (condition):
- if counter > 50:
- condition = False
- counter += 1
- print(counter)
- # do stuff