-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.py
More file actions
45 lines (36 loc) · 734 Bytes
/
hello.py
File metadata and controls
45 lines (36 loc) · 734 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
# working with expressions
print("Hello world of python")
print(1 + 1)
print(1.0 + 1)
parham = 1
print(parham)
# working with tuples
a = ("Parham", "Navid", "Mohammad")
b = (a, "Bahador")
print(b)
print(a.count("Parham"))
# working with lists - 1
a = ["Parham", "Navid", "Mohammad"]
b = [a, "Bahador"]
print(b)
b[0][0] = "Parham Alvani"
print(a)
a.sort()
print(a)
# working with lists - 2
var = [10, 20, 30]
c = (var, 10)
print(c)
var = var.append(40)
print(c)
# for-loop with else
for name in a:
print(name)
else:
print("loop finish correctly without break")
# defining an inner-function, functions are first-class citizenes
def retfunc(a):
def f(b):
print("%d %d" % (a, b))
return f
retfunc(10)(20)