In this program, we will generate a random binary string of a given length.
Steps to solve the program
- Import the random library to generate random numbers and create an empty string.
- Using for loop with range() function and random.randint generates a random binary number of a given length and add it to the empty string.
- Print the output.
Output :
Note: Output can be different since the numbers are selected randomly.