# Python Question (write programs)

*label*Computer Science

*timer*Asked: May 26th, 2015

**Question description**

**Requirement:**

**1. You cannot import any module**

**2. The programs must be solved by R****ecursion**

Question:

1. Write program

1.Write a program that asks the user for a binary string that also contains x's. A binary string is a sequence of 1's and 0's. Your program should display all possible binary strings where the x's can be replaced with either 1's or 0's.

a.Examples

Enter a binary string: 1011

`1011`

Enter a binary string: 10x0

1000 1010Enter a binary string: xx0x

0000

0001

0100

0101

1000

1001

1100

1101

2. Write program

1.Write a program that is called funa() that implements the following function (part a&b below)

2.Write one more program that also is called funa() that implements the same function from last question but only makes one recursive call per recursion.

a.

funa(0)=1

funa(1)=2

funa(2)=3

funa(3)=4

funa(n)= funa(n−1)+ funa(n−3)+ funa(n−4)

b. Examples

funa(15) = 1428

Enter a value for n: 3

funa(3) = 4

Enter a value for n: 5

funa(5) = 12

- Enter a value for n: 15