Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python Write a function generate_binary_numbers that takes a number N as a parameter and returns a queue of binary number strings from 1 to N
python
Write a function generate_binary_numbers that takes a number N as a parameter and returns a queue of binary number strings from 1 to N without using any built-in or library functions like bin(). In fact, your solution should not use any built-in or library functions other than those in the Stack and Queue classes provided. The front of the queue begins @ '1'. If N is too small, return an empty queue.
fix generate_binary.py to pass generate_binary_test.py
6 00 generate_binary_test.py 1 # TEST FILE FOR GENERATE BINARY NUMBERS 2 # DO NOT MODIFY 3 4 from Queue import Queue 5 from generate_binary import generate_binary_numbers 6 7 def test_binary_0(): assert generate_binary_numbers (0) == Queue ([]) 9 10 def test_binary_1(): 11 assert generate_binary_numbers(1) == Queue (['1']) 12 13 def test_binary_2(): assert generate_binary_numbers (2) == Queue (['1', 1 '10']) 15 16 def test_binary_3(): 17 assert generate_binary_numbers (3) == Queue ('l', '10', '11'] ) 18 19 E def test_binary_4(): 20 assert generate_binary_numbers (4) == Queue ( ['1', '10', '11', '100'] ) 21 22 E def test_binary_5(): 23 assert generate_binary_numbers (5) == Queue( ['1', '10', '11', '100', '101'] ) 14 generate_binary.py # ASSIGNMENT: Technical HW: Stacks & Queues 5 6 7 def 00 9 Edef main(): 10 generate_binary_numbers (2) 11 generate_binary_numbers (3) 12 generate_binary_numbers (6) 13 14 15 # Don't run main on import 16 if __name_ == "__main__": 17 main() ( 18 19Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started