-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path055-oct.py
More file actions
30 lines (21 loc) · 784 Bytes
/
Copy path055-oct.py
File metadata and controls
30 lines (21 loc) · 784 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
"""
Return the octal value of any integer
-------------------------------------
Input: (int) any integer
Return: (oct) octal version of integer
return always begins with '0o'
"""
int_1 = 1
print('Integer: {}\nOctal value: {}'.format(int_1, oct(int_1)))
int_2 = 20
print('\nInteger: {}\nOctal value: {}'.format(int_2, oct(int_2)))
int_3 = -20
print('\nInteger: {}\nOctal value: {}'.format(int_3, oct(int_3)))
int_4 = 0
print('\nInteger: {}\nOctal value: {}'.format(int_4, oct(int_4)))
int_5 = 16
print('\nInteger: {}\nOctal value: {}'.format(int_5, oct(int_5)))
int_6 = -8
print('\nInteger: {}\nOctal value: {}'.format(int_6, oct(int_6)))
int_7 = 7
print('\nInteger: {}\nOctal value: {}'.format(int_7, oct(int_7)))