-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLearnPython.py
67 lines (46 loc) · 1.19 KB
/
LearnPython.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
# Enter the Settings and go to Keymap.
# Search for Execute Selection in Console and reassign it to a new shortcut, like Crl+Enter.
# This is the same shortcut to the same action in Spyder and R-Studio.
# Shift+ALT+E
# Created 17-2-2019
# by Jan Kruijdenberg
numberstaken =[2,5,12,13,17]
print("Hey")
for n in range(1,20):
if n in numberstaken:
continue
print(n)
help(round)
#Function tutorial 15,16
def beef(btc, a=True):
print("Hoi")
Amount=btc*12345
print(Amount)
if a is True:
print("True")
else:
print("Hoi Jan")
return Amount
a= beef(1323)
type(a)
print(round(beef(1323, False)/123443,3))
n=range(0,100,5)
b=n[4]
#Flexible amount of arguments; tutorial 17
def add_numbers(*args):
total=0
for a in args:
total +=a
print(total)
add_numbers(3,5,4,6,8,4,2)
#18 - Unpacking Arguments
#19 Sets
groceries = { "serial","milk","duct tape","beer", "milk"} # milk is er twee maal
print(groceries)
#Dictionaries; keys and values
classmates ={"Tony":"cool but smells", "Emma": "Sits behind me", "Lucy":"Asks too many questions"}
print(classmates)
print(classmates["Emma"])
for k,v in classmates.items():
print(k+" "+v)
#