-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkshop.py
More file actions
60 lines (49 loc) · 1006 Bytes
/
workshop.py
File metadata and controls
60 lines (49 loc) · 1006 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
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
#variables and functions
b = 2 + 3
a = b/5
c = (a + 1)**2
d = abs(-1 * c)
def add_tip(total, tip_percent):
''' Return the total amount of a meal including tip'''
tip = tip_percent*total
return total + tip
finalprice = add_tip(20, 0.15)
print(finalprice)
'''
this is a multiline comment
as you can see I can type in comments
on multiple lines
'''
#==, !=, >, < , >=, <=
'''
lets try if else statements now
'''
if (27>5):
print("27 is more then 5")
test = True
def check_test(test):
if (test):
print("if statement")
else:
print("else statement")
'''strings and lists'''
l = [1,2,3,4,5,6]
s = "string"
'''loops'''
for item in l:
print(item)
for char in s:
print(char)
for x in range(0, 5):
print(l[x])
for x in range(0, 5, 2):
print(l[x])
'''sets'''
somelist = [1,1,2,2,3,3]
someset = set(somelist)
print(someset)
'''while loops'''
num = 0
while(num < 5):
print(num)
num+=1