Python 3 Questiones - 1

FratBro23
Category:
Computer Science
Price: $5 USD

Question description

Python 3 Questiones (write the program)

Requirement:

1. You cannot import any module

2. The programs must be solved by Recursion 

3. Please use Python 3

4. Please Question 1 and Question 2-2

-----------------------------------------

Question 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
1010

Enter a binary string: xx0x

0000

0001

0100

0101

1000

1001

1100

1101

Question 2:

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

(I did Question 2-1, so you just need to do Question 2 - 2. Also, I can give you Question2-1 code if you want)

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

Enter a value for n: 3 

funa(3) = 4
Enter a value for n: 15
funa(15) = 1428
Enter a value for n: 5
funa(5) = 12

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Cornell University
PREMIUM TUTOR
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1831 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors