Question: Use the Design Recipe to write a function bools_2_str , which consumes a list of booleans and returns a string of the same length as
Use the Design Recipe to write a function bools_2_str, which consumes a list of booleans and returns a string of the same length as the list. Where the list has True, the string should have 'X', and where the list has False, the string should have ' ' (i.e., a single space).
Test = print(bools_2_str([True,False,True,False,True]))
Result = 'X X X'
python Language
|
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
