# lesson1.py

# -*- coding: utf-8 -*-
"""
Numeric conversions
@authors: geokoutsiouri katkaranikola stkarlos
"""
a = input('give an integer number on decimal system: ')
# example a = 63
print type(a)
# convert a if an error exists
print ''
print 'Equivalent number of %d to binary      system is %s' % (a, bin(a) )
print 'Equivalent number of %d to octal       system is %s' % (a, oct(a) )
print 'Equivalent number of %d to hexadecimal system is %s' % (a, hex(a) )
print ''
b = raw_input('give the digits of a number on   binary    system: ')
o = raw_input('give the digits of a number on   octal     system: ')
h = raw_input('give the digits of a number on hexadecimal system: ')
print ''
#b = '111111'
#o = '077'
#h = '3f'
print ''
print 'Equivalent number of %s to decimal system is %d' % (b, int(b, 2) )
print 'Equivalent number of %s to decimal system is %d' % (o, int(o, 8) )
print 'Equivalent number of %s to decimal system is %d' % (h, int(h,16) )
print ''
#print int(b,2)
#print int(o,8)
#print int(h,16)
print 'End of lesson1'

Posted in Uncategorized