-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpart1.py
More file actions
42 lines (26 loc) · 719 Bytes
/
part1.py
File metadata and controls
42 lines (26 loc) · 719 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
eecs388 = None
def str_to_bytes(s: str) -> bytes:
return
def hex_to_bytes(s: str) -> bytes:
return
def int_to_bytes(n: int) -> bytes:
return
def set_end_to_zero(b):
return
# Feel free to edit the main function however you like to help you debug, it won't be graded
#
# Run this script with the command: python3 part1.py
# or select "Part 1" from the VS Code debugger
def main():
print(eecs388)
bytes1 = str_to_bytes('Hello, world!')
print(bytes1)
bytes2 = hex_to_bytes('a2f295ac')
print(bytes2)
bytes3 = int_to_bytes(100599730)
print(bytes3)
b = bytearray(b'\x01\x02\x03\x04\x05')
set_end_to_zero(b)
print(b)
if __name__ == '__main__':
main()