-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlsit.py
More file actions
32 lines (25 loc) · 729 Bytes
/
Copy pathlsit.py
File metadata and controls
32 lines (25 loc) · 729 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
32
# Lists are set in square brackets
# Items in the list are separated by commas.
listOne = [1,2,3]
listTwo = ["Apple","Mango","Pine Apple"]
print(listOne)
print(listTwo)
# List operations
# Append an element to list
listOne.append("Kiwi")
#Replace an element in the list
listTwo[2] = "Water melon!"
print("Please enter your input")
while True:
element = input()
if element is str:
print("String found adding to list two")
listTwo.append(element)
elif element is int:
print("Integer found adding to list one")
listOne.append(element)
else:
print("Unidentified data type found. Try again. Exiting the commad!")
break
for eachItem in listOne:
print(eachItem)