Hello there,
I was trying to print a simple number using this code:
" print ("Test output %d" % 050) "
but it is giving following output
" Test output 40 "
I need this explanation why it is showing this result.
In Fact I've tried with few more code and the respective output is given below with the code.. Please Help me with the explanation..
Sample 1:
print ("Test Output %d" % 0100)
Test Output 64
Sample 2:
print ("Test Output %d" % 060)
Test Output 48
Sample 3:
print ("Test Output %d" % 020)
Test Output 16
Sample 4:
print ("Test Output %d" % 010)
Test Output 8
Sample 5: (It actually provide error)
print ("Test Output %d" % 080)
output:
print ("Test Output %d" % 080)
^
SyntaxError: invalid token
I was trying to print a simple number using this code:
" print ("Test output %d" % 050) "
but it is giving following output
" Test output 40 "
I need this explanation why it is showing this result.
In Fact I've tried with few more code and the respective output is given below with the code.. Please Help me with the explanation..
Sample 1:
print ("Test Output %d" % 0100)
Test Output 64
Sample 2:
print ("Test Output %d" % 060)
Test Output 48
Sample 3:
print ("Test Output %d" % 020)
Test Output 16
Sample 4:
print ("Test Output %d" % 010)
Test Output 8
Sample 5: (It actually provide error)
print ("Test Output %d" % 080)
output:
print ("Test Output %d" % 080)
^
SyntaxError: invalid token
Comment