choice = "yes" while choice=="yes": n = int(input("1. Binary To decimal\n2. Decimal to Hexadecimal\n3. Binary to Hexadecimal\n4. Decimal to Binary\n5. Hexadecimal to Decima if n==1: 2 # Code to...




help me add this in my python code
- addition, subtraction, multiplication, division of binary numbers
-must be able to use two complement (negative numbers). Only integers, no fractions needed.
-Input & output 16 bit numbers
here's my on the images

and here's the n part :



n = int(input("1. Binary To decimal\n2. Decimal to Hexadecimal\n3. Binary to Hexadecimal\n4. Decimal to Binary\n5. Hexadecimal to Decimal\n6. Hexadecimal to Binary\nEnter your choice: "))




choice =

Extracted text: choice = "yes" while choice=="yes": n = int(input("1. Binary To decimal\n2. Decimal to Hexadecimal\n3. Binary to Hexadecimal\n4. Decimal to Binary\n5. Hexadecimal to Decima if n==1: 2 # Code to convert binary to decimal s = input("\nEnter Binary value: ") print ("Decimal value is: ",int(s,2)) 5 6 7 8 9 elif n==2: 10 # Code to convert decimal to hexadecimal s = input("\nEnter Decimal value: ") print("Hexadecimal value is: ", hex(int(s))[2:].upper()) 11 12 13 14 elif n==3: # Code to convert binary to hexadecimal s = input("\nEnter Binary value: ") print("Hexadecimal value is: ", hex(int(int(s,2)))[2:].upper()) 15 16 17 18 19 elif n==4: # Code to convert decimal to binary s = int(input("\nEnter Decimal value: ")) print("Binary value is: ", bin(s).replace("Ob", "")) 20 21 22 23 24 25 elif n==5: 26 # Code to convert hex to decimal s = input("\nEnter Hexadecimal value: ") print ("Decimal value is: ", int(s, 16)) 27 28 29 30 elif n==6: # Code to convert hex to binary s = input("\nEnter Hexadecimal value: ") print("Binary value is: ", bin(int(s, 16))[2:].upper()) 31 32 33 34 35 else: 36 print ("\nInvalid input") 37 print("\nDo you want to do more: ") choice=input("Enter you choice: ") 38 39
print(

Extracted text: print("\nDo you want to do more: ") choice=input ("Enter you choice: ") # If user enters no it will stop else continue the program again if(choice=="no"): break
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here