Question: I am trying to solve this python question but I cannot get the required result because it says DO NOT USE: No use of bin
Write a program that takes no input frou the user, but prints a raucdkom 8-digit binary number, aud its base-10 equivalent. Specifically, your program should use the randon module to pick 8 randosn nuabers that should each be either or 1. The progiam should theu display those S digits in a tow, togerher with the equivalent decirnal umber. When you run your program, a sample zua might look like this Here's a randon example of binary The binary number 1 0 0 0 1 1 1 ic thu ,aau au the decaal Buaber 142. or this: Here's a randox example of binary The binary rumber o 11 0 01 1 1s the same au the dectnal nueber 51 Every time I run the program. I shouid get a diferent number (between 0 sni 255). You should be able to complete this progeam (and the chalenge) only sing things we have discussed already ir: the class: don't use lists or tuples (these are sequenecs of variables enelosod in eiths [ or )), don't usc use any of Python's functions for binary (like bin). e statenents are acceptable, but uesry. Inst mathematics mltiplication, exponentint ion. and maybe / andx (the last tmo might telpful for the chailenge) Specifications your program must . accept NO user input . use randos to generate eight different Tandoni mimber euch should be 0 or 1 . display the eight generated digits, as weill as the equivaleat decimal number. in the tuatiner rbets listed like 1 0 1 0 1 1 00, aot lise (1, o, 1, , 1, 1, o, o). (10101100, without the spaces in betwwen, s scceptable) display different numbers each time the progratn is run. . only use techniques that we have discussed in clase t thues far- n particular, no use of the bin function, no use of loops, and no use of lists or tuples. er this geston, have the prugrum rontimae by asking the user to type in a uumber betveen 0 and you answer this guesthon, haue the Chailenge: aster .n erinting out the binary equialent. For ezaraple, a run might look like this (uhere the user enters the value 24) Now, enter a deciaal number betveen 0 and 256: 24 This nuaber is equivalent to the binary munber
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
