-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path1193.py
More file actions
31 lines (28 loc) · 719 Bytes
/
1193.py
File metadata and controls
31 lines (28 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
n = int(input())
for cont in range (n+1)[1::]:
valores = input()
entrada = valores.split()
x = str(entrada[0])
y = str(entrada[1])
if y=='bin':
print('Case %d:' % cont)
aux = int(x,2)
print(aux, 'dec')
print(hex(aux)[2::], end=' ')
print('hex')
print()
elif y=='dec':
print('Case %d:' % cont)
aux = int(x)
print(hex(aux)[2::], end=' ')
print('hex')
print(bin(aux)[2::], end=' ')
print('bin')
print()
else:
print('Case %d:' % cont)
aux = int(x,16)
print(aux, 'dec')
print(bin(aux)[2::], end=' ')
print('bin')
print()