Interview Question

Data Science Interview

-Toronto, ON

Shopify

Consider the following bit string 11?100 you need to write a method which can replace this question mark with 1 & 0 Output should be: 110100 , 111100 This should be implemented for N number of question mark each time replaced with 1 and then with 0

Answer

Interview Answers

2 Answers

1

Then u can iterate over the generator function

Anonymous on

0

def ques_remover(N): for e in range(N): if e%2 == 0: yield ‘110100’ else: yield ‘111100’

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.