Python Interviews: Difference between revisions

Line 204:
lst.append(numbers)
print("Sum of elements in given list is :", sum(lst))
 
= Convert Numeral System =
 
for i in range(0,10):
print(i, oct(i), hex(i), bin(i))
 
for i in range(0,10):
print(i, oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:])
 
= Justify Text =
 
[https://pyformat.info/ pyformat.info]
 
text.rjust(3,' ')
text.ljust(3,' ')
text.center(3,' ')