forked from NicolasFeng597/CB-South-Coding-Club
-
Notifications
You must be signed in to change notification settings - Fork 0
/
learn.py
75 lines (53 loc) · 1.31 KB
/
learn.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
68
69
70
71
72
73
74
75
"""x = 0
str = "string"
for num in str:
print(num)
for i in range(1, 101):
x = x + i
x = 1
y = 5
while x != y:
print(x)
x += 1
print("exited")
"""
list = [3, 6, 7, 6, 7, 10, 12, 13, 11, 12]
str_list = ["Kevin", "Coding", "Club", "CB South", "Python"]
list2 = [1, 2, 3, 4]
def second_largest(list):
list.remove(max(list))
return max(list)
print(second_largest(list))
#max()
#min()
str_list.sort()
print(str_list)
str_list.remove("Club")
print(str_list)
#append() #adds element to end of list
#clear() #removes all elements from list
#copy() #returns a copy of list
#count() #returns number of elements with value
#extend() #for combining elements in two lists
#index() #returns index of first element with value
#insert() #inserts element at index position
#pop() #removes the element index position
#remove() #removes first item with value
#sort() sorts list
#reverse()
#in, not in
"""def my_max(list):
temp_max = list[0]
for num in list:
if num > temp_max:
temp_max = num
return temp_max
def my_min(list):
temp_max = list[0]
for num in list:
if num < temp_max:
temp_max = num
return temp_max
print(my_min(list))"""
x = input("What's your name?")
print(x)