-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_test.py
42 lines (27 loc) · 815 Bytes
/
01_test.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
"""
01 - test file
Just to test if the project and the GitHub are set up correctly.
"""
from studyLib import *
# print a concatenation of strings, access library through shortcut
print("pi is >> " + str(np.pi))
# for loop, TicToc usage
tic()
for i in range(600):
print("i = " + str(i))
toc()
# booleans
Hamlet = (True or (not True)) # as 'To be or not to be'
# calling functions, if/else
def shakespeare_says(thought):
if thought == True:
return "To be"
else: # thought == False
return "Not to be"
# using functions
print("The answer to Hamlet's question is: " + shakespeare_says(Hamlet))
# lambda functions
# in Python, they are always anonymous: you can call them as var(agrs) (see in printing below),
# but you cannot name them.
x = lambda a, b: a * b
print(x(5, 6))