-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlists.py
More file actions
31 lines (24 loc) · 776 Bytes
/
lists.py
File metadata and controls
31 lines (24 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
names = ["Larry", "Danny", "Python", "List", "Name"]
print("Full lists:")
print(names)
print("Get name using index of lists:")
print(names[2])
print("Update 3 index text lists:")
names[3] = "React"
print(names)
print("Using range operator [start:end]:")
print("Display 2 and 3 index value means less one from end index")
print(names[2:4])
print("if no start and end index display full lists")
print(names[:])
print("if no start index, default start 0")
print(names[:3])
print("if no end index, display start to rest of all from lists")
print(names[2:])
# Write a program to find largest number in a list
numbers = [12, 2, 234, 34, 113]
largestNumber = numbers[0]
for number in numbers:
if largestNumber < number:
largestNumber = number
print(largestNumber)