more formatting
This commit is contained in:
parent
4419116901
commit
8c9d854f16
@ -12,12 +12,12 @@ while True:
|
||||
|
||||
Binary Addition
|
||||
Floating point binary
|
||||
Twos compliment, Sign & Magnitude, Negative binary, Complex binary
|
||||
Twos compliment, Sign & Magnitude, Complex binary
|
||||
'''
|
||||
type_int = random.randint(0,2)
|
||||
|
||||
if type_int == 2:
|
||||
print("What is this binary floating point number in denery?")
|
||||
print("What is this binary floating point number in denery?\n")
|
||||
int_length = random.randint(0,7)
|
||||
decimal_length = random.randint(1,7)
|
||||
answer = float(random.randint(0,2**int_length))
|
||||
@ -38,9 +38,9 @@ while True:
|
||||
if type_int == 1:
|
||||
answer_in_bin_or_den = random.randint(0,1)
|
||||
if answer_in_bin_or_den == 1:
|
||||
print("Answer in Base 10")
|
||||
print("Answer in Base 10\n")
|
||||
if answer_in_bin_or_den == 0:
|
||||
print("Answer in Base 2")
|
||||
print("Answer in Base 2\n")
|
||||
numbers_to_add = random.randint(2,2)
|
||||
numbers = []
|
||||
answer = 0
|
||||
@ -130,7 +130,7 @@ while True:
|
||||
else:
|
||||
print(f"No, the answer was {hex(int(start_number))[2:]}")
|
||||
if final_base == 10:
|
||||
if attempt == str(int(start_number)):
|
||||
if str(int(attempt)) == str(int(start_number)):
|
||||
print("Correct")
|
||||
else:
|
||||
print(f"No, the answer was {int(start_number)}")
|
||||
@ -140,4 +140,4 @@ while True:
|
||||
else:
|
||||
print(f"No, the answer was {bin(start_number)[2:]}")
|
||||
|
||||
print("------------------------------------")
|
||||
print("\n------------------------------------\n")
|
||||
|
Loading…
Reference in New Issue
Block a user