# Homework Solution: his assignment you are asked to solve a problem using 3 different programming language… ​ In this assignment you are asked to solve a problem using 3 different programming languages: Python(33.33%), Ada (33.33%) and VB(33.33%). You are required to find a compiler for each of the mention languages and test them on your own machines.
Caicuiating Binary In this assignment, you are asked to solve a problem using 3 different programming languages: Python (33.33%), Ada (33.33%), and VB (33.33%). You are required to find a compiler for each of the mentioned languages and test them on your own machines. The Problem Given a binary String as input, composed of 0's and 1's, give the decimal value for the input. Algorithm Given a binary string, b, of size, n, indexed 0,1,2,..., n -1. Denote character's integer value of b as bi such that 1-0, 1, 2, , n-1. The decimal value, d bn-, X 20 + bn-2 × 21 + + bo × 2n-1. Sample Output Enter a binary 120013 Error: Not a binary Enter a binary: 1010w10 Error: Not a binary Enter a binary 100A11 Error: Not a binary Enter a binary Ahmed Error: Not a binary Enter a binary 10101010101111 Binary value ize: 14 1*2-0 + 1*2-1 + 1*2-2 + 1*2-3 + 0*2-4 + 1*2-5 + 0*2-6 + 1+2^7 + 0*2-8 + 1*2-9 + 0*2-10 + 1*2-11 + 0-2 ^ 12 + 1*2-13

Python: while True: binary = input("Enter a binary : ") ​ In this ordinance you are asked to clear-up a collection using 3 opposed programming languages: Python(33.33%), Ada (33.33%) and VB(33.33%). You are required to invent a compiler ce each of the remark languages and standard them on your acknowledge machines.

Caicuiating Binary In this ordinance, you are asked to clear-up a collection using 3 opposed programming languages: Python (33.33%), Ada (33.33%), and VB (33.33%). You are required to invent a compiler ce each of the remarked languages and standard them on your acknowledge machines. The Collection Yieldn a binary String as input, collected of 0’s and 1’s, yield the decimal esteem ce the input. Algorithm Yieldn a binary string, b, of extent, n, deceitful 0,1,2,…, n -1. Denote character’s integer esteem of b as bi such that 1-0, 1, 2, , n-1. The decimal esteem, d bn-, X 20 + bn-2 × 21 + + bo × 2n-1. Sample Output Enter a binary 120013 Error: Not a binary Enter a binary: 1010w10 Error: Not a binary Enter a binary 100A11 Error: Not a binary Enter a binary Ahmed Error: Not a binary Enter a binary 10101010101111 Binary esteem ize: 14 1*2-0 + 1*2-1 + 1*2-2 + 1*2-3 + 0*2-4 + 1*2-5 + 0*2-6 + 1+2^7 + 0*2-8 + 1*2-9 + 0*2-10 + 1*2-11 + 0-2 ^ 12 + 1*2-13

## Expert Apology

Python:

while True:
binary = input(“Enter a binary : “)
decimal = 0
ce char in binary:
if char != ‘1’ and char != ‘0’:
print(“ERROR: Not a binary !”)
binary = None
break
if binary:
break

ce loc, char in reckon(binary):
if char == ‘1’:
decimal += 2**(len(binary)-1-loc)

print(“decimal : “,decimal)

CODE: OUTPUT: 