forked from JD235/first-python-file
-
Notifications
You must be signed in to change notification settings - Fork 0
/
first.py
70 lines (58 loc) · 1.27 KB
/
first.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
import time;
print("hello there")
a = b = c = 1, 2, "JD"
print(a, b, c)
list = ['abcd', 786, 2.23, 'john', 70.2]
tinylist = [123, 'john']
print(list)
print(list[0])
print(list[1:4])
print(list[2:])
print(list[:2])
print(list[:-1])
print(tinylist * 2)
print(list + tinylist)
tuple = ("abcd", 1, 2)
print(tuple)
dict = {}
dict["one"] = "this is one"
dict[2] = "this is two"
tinydict = {"name": "JD", "code": 1122, "dept": "Web"}
print(dict["one"])
print(dict[2])
print(tinydict)
print(tinydict.keys())
print(tinydict.values())
tinydict["code"]=1111;
print(tinydict)
x = y = z = 10
print(len(tuple))
x, y = 1, 2
print("Value of x , y : ", x, y);
def ti():
localtime = time.asctime( time.localtime(time.time()) )
print ("Local current time :", localtime)
ti();
def cha(t):
t=10;
print(t);
t=20;
cha(t);
print(t);
def printinfo(age,name):
print("age:", age);
print("name:", name);
printinfo(name="JD", age=20);
def printnum(args1,*vartuple):
print(args1);
for var in vartuple:
print(var);
printnum(10);
printnum(10,20,30,40,50,60);
def sum(arg1,arg2):
total=arg1+arg2;
print(total);
return total;
sum(40,50);
sums=lambda args3, agrs4: args3 + agrs4;
print(sum(10, 50));