Python 3 Questiones (write the program)

May 27th, 2015
SoccerBoss
Category:
Computer Science
Price: $10 USD

Question description

Requirement:

1. You cannot import any module

2. The programs must be solved by Recursion 

3. Please use Python 3

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

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)

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: Rice University
PREMIUM TUTOR

Studypool has helped 1,244,100 students

8 Reviews


Summary
Quality
Communication
On Time
Value
tinytim47
Dec 5th, 2016
" Wow this is really good.... didn't expect it. Sweet!!!! "
Five Star Tutor
Nov 23rd, 2016
" Outstanding Job!!!! "
mixedballz
Nov 21st, 2016
" excellent work as always thanks for the help "
lilmoe415
Nov 12th, 2016
" Thank you, Thank you, for top quality work, this is your guy!! "
darnay
Oct 30th, 2016
" The best tutor out there!!!! "
dontuwannaknow
Oct 21st, 2016
" Excellent work as always thanks so much "
SjSurvivor143
Oct 7th, 2016
" Thanks for the help. "
Joemoe
Sep 24th, 2016
" <3 it, thanks for saving me time. "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1829 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