Python Week 11 Programming Assignment Solutions 2021

 

Week 11 Programming Assignment 1

Due on 2021-04-08, 23:59 IST
Let ‘n’ be a positive even integer. Print the total number of ways to express ‘n’ as a sum of only even positive integers. 

Input format :
The positive even integer
Output format :
the total number of ways to express ‘n’ as a sum of only even positive integers else invalid

Example 
input
6
 
output
4

Explanation: There only 4 ways to express ‘6’ as sum of even integers:
First way:  6
Second way: 2 + 4
Third way:  4 + 2
Fourth way: 2 + 2 + 2 + 2


 

 




Week 11 Programming Assignment 2

Due on 2021-04-08, 23:59 IST

Give a string, remove all the punctuations in it and print only the words in it. 

Input format : the input string with punctuations

Output format : the output string without punctuations

Example 

input

“Wow!!! It’s a beautiful morning”

 

output

Wow Its a beautiful morning


 

 





Week 11 Programming Assignment 3

Due on 2021-04-08, 23:59 IST

print the number of binary sequences of length ‘n’ that have no consecutive 0’s

Input format : A number 'n'

Output format : number of binary sequences of length 'n' with no consecutive 0's else invalid

Example 

input

3

output

5

Explanation: 

When n = 3, number of binary digits is 3.

all possible combinations of 3 binary digits are

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

out of these eight possibilities, 5 have binary sequences and have no consecutive 0’s. Hence the number of binary sequences of length 3 is 5.


 

 


Post a Comment (0)
Previous Post Next Post