type(15)
type(21.65)
print(type("Goodnight All"))
<class 'str'>
animal = "lion"
print(animal)
lion
string = "Toy Story 4"
print(string)
Toy Story 4
my_list = ["quizzes", .19, "homework", .15]
print(my_list)
['quizzes', 0.19, 'homework', 0.15]
my_horses = ["Sonata", "Ranger"]
print(my_horses)
['Sonata', 'Ranger']
my_list = [16, 71.2, "January"]
print(my_list)
[16, 71.2, 'January']
string = "Toy Story 4"
print(string)
my_list = ["quizzes", .19, "homework", .15]
print(my_list)
['quizzes', 0.19, 'homework', 0.15]
print(string[2])
y
print(my_list[1])
0.19
print(string[-1])
4
print(my_list[-2])
homework
print(my_list[-4])
quizzes
print(string[0:])
Toy Story 4
new_list = my_list.copy()
new_list.pop(0)
new_list.pop(0)
print(new_list)
['homework', 0.15]
print(string[4:10])
Story
print(my_list[1:3])
[0.19, 'homework']
my_list.pop()
my_list.append(.18)
print(my_list)
['quizzes', 0.19, 'homework', 0.18]
string.pop()
string.append(3)
print(string)
AttributeError: 'str' object has no attribute 'pop'
dickens = "It was the best of times"
print(dickens.upper())
IT WAS THE BEST OF TIMES
print(dickens.split())
['It', 'was', 'the', 'best', 'of', 'times']
print(dickens.split("t"))
['I', ' was ', 'he bes', ' of ', 'imes']
numbers = [2, 5, 12, -13, 100, -3, -2]
print(max(numbers))
100
print(min(numbers))
-13
print(sum(numbers))
101
list1= [ 4.5, 7.1, 'Seminoles']
list1.append("FSU")
print(list1)
[4.5, 7.1, 'Seminoles', 'FSU']
list2 = list1.copy()
list2.pop()
list2.pop()
print(list2)
[4.5, 7.1]
colors = [ 'red', 'orange', 'yellow', 'blue', 'indigo', 'violet']
colors.pop(4)
print(colors)
['red', 'orange', 'yellow', 'blue', 'violet']
colors.insert(4, "green")
print(colors)
['red', 'orange', 'yellow', 'blue', 'green', 'violet']
colors.insert(4, "indigo")
print(colors)
['red', 'orange', 'yellow', 'blue', 'indigo', 'green', 'violet']
list3 = [14, 21, 17, 2, 6]
print(f"17 is at index {list3.index(17)}")
17 is at index 2
print(f"The minimum number is at index {list3.index(min(list3))}")
The minimum number is at index 3
prime = []
prime.append(11)
prime.append(13)
print(prime)
[11, 13]