On 2/13/2013 2:13 PM, Ghadir Ghasemi wrote:
Hi guys can you tell me what is wrong with this code?. It says unexpected
indent and the bottom of the code everytime I run it. Thank you
Please post the entire traceback - there is valuable information there.
Without that we have to go on a time consuming witch hunt. We are
volunteers who love to help - with limits on our time and energy.
Do you understand how Python uses indentation? The error you report says
you have violated the indentation rules.
on=True
while on == True:
def eight_digit_binary1(message):
response1 = input(message)
while len(response1) > 8:
response1 = input(message)
return (response1)
try:
binary1 = eight_digit_binary1('please enter the first 8 bit binary
number: ');
denary1 = 0
place_value1 = 1
for i in binary1 [::-1]:
denary1 += place_value1 * int(i)
place_value1 *= 2
def eight_digit_binary2(message):
response2 = input(message)
while len(response2) > 8:
response2 = input(message)
return (response2)
try:
binary2 = eight_digit_binary2('please enter the first 8 bit binary
number: ');
denary2 = 0
place_value2 = 1
for i in binary2 [::-1]:
denary2 += place_value2 * int(i)
place_value2 *= 2
def print_result(result):
result = (place_value1 + place_value2)
remainder = ''
while result > 0:
remainder = str(result % 2) + remainder
result >>= 1
print("The result is",remainder)
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
919-636-4239
Chapel Hill NC
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor