-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday4.py
More file actions
60 lines (57 loc) · 1.05 KB
/
day4.py
File metadata and controls
60 lines (57 loc) · 1.05 KB
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
# # FUNCTION
# def add(a,b):
# return a + b
# print(add(3,4))
#
# def haha(c,d):
# return c+d, c-d
# print(haha(6,5))
# t,y = haha(9,8)
# print(t,y)
#
# def my_s(str):
# print(str + ' jjjjj')
# my_s('haha')
# my_s()
# def power(base, exp):
# return base ** exp
# print(power(3,4))
# print(power(exp=4,base=3))
#
# def addd(a1, a2=2, a3=3):
# return a1 + a2 + a3
# print(addd(3,8,9))
# print(addd(5))
#
# def po2(*ddd):
# a,b,c,d = ddd
# return a +b + c + d
#
# print(po2(1,2,3,7))
# # LAMBDA FUNCTION
# vuong = lambda x,y: x+y
# print(vuong(5,7))
# # MODULE
# import test as doan
# print(doan.add(3,5))
# from test import *
# v = add(5,6)
# print(v)
# INPUT/OUTPUT
# file1 = open('document.txt','r')
# filect = file1.readlines()
# for i in filect:
# print(i)
# file1.close()
#
# f = open('out.txt','wt')
# print('hi', file=f)
# f.close()
f = open('out.txt','rb+')
print(f.write(b'0123456789abcdef'))
f.seek(5)
print(f.read(1))
f.seek(-8,2)
print(f.read(1))
print(f.read(2))
f.close()