/
Listapp1v4.py
67 lines (58 loc) · 2.08 KB
/
Listapp1v4.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import random
MyList = []
def MainProgram():
while True:
try:
print("HELLO. me ugg. me make list")
print("type number to choose from optios below and me do that")
choice = input("""1. add to list.
2.return the value index position.
3.random search
4.add a lot of intergers
5.print the list
6.Exit program""")
if choice == "1":
AddToList()
elif choice == "2":
IndexValues()
elif choice == "3":
RandomSearch()
elif choice == "69":
print("nice")
elif choice == "4":
AddABnuch()
elif choice == "5":
Print()
else:
break
except:
print("You make error. Ugg can not understand error.")
# to add: 1 a way to loop action. 2 a way to quit. 3 think of repition
def AddToList():
print("add item to list. yes. me do that!")
NewItem = input("type an interger here")
MyList.append(int(NewItem))
def AddABunch():
print("u want add many interger. me can do that")
NumToAdd = input("how many thing u want add ")
NumRange = input(" how high yoy wabt number to go? ")
for x in range(0, int(NumToAdd)):
MyList.append(random.randit(0,int(NumRange)))
print("Ugg has finished list")
def Print():
print(MyList)
def IndexValues():
print("OOOOUUAAAAGGGGHH. I hear you need certian peice of data.")
indexPos = input ("ugg must know position of data")
print(MyList[int(indexPos)])
def RandomSearch():
print("ugg will random choose item")
print(MyList[random.randit(0, len(MyList))-1])
def LinearSearch():
print("Ugg will check every item on list for you. Ugg hate checking every item. every. item. ")
SearchItem = input = ("what you look for? ")
for x in range(len(MyList)):
if MyList[x] == int(SearchItem):
print("your item is at index position {}".format(x))
if __name__ == '__main__':
MainProgram()