Assignment 10

1. Write a program which returns the year and name of weekday

2. Write a module for calculator. Perform all the basic mathematical operations using the created module.

3. Print all the modules, variables and functions that are defined under module random.

4. Import datetime module and print current date and time.

5. Import Calendar module and print the calendar of any year.

6. Check whether a given year is leap year or not. Provide a range of years and display how many leap years are there.

7. Print a month by importing calendar module.

8. Write a program to print a given datetime.

9. Display the name of the month.

10. Print the month names of calendar .

11. Print the name of days in a week.

12. Write a program which will print the month name and first Monday in a given year.

13. Print the current date and time in the following format.

year: 2018

month: 12

day: 24

time: 04:59:31

date and time: 12/24/2018, 04:59:31

14. Write a Python program importing random which outputs the frequency of occurrence of each faces for rolling a dice 6000 times.15. Create a module which contains the functions as stated below.

a) F(x,y)=F(x-y,y)+1, if y ≤ x

b) F(n,r)=F(n-1,r)+F(n-1,r-1)

c) F(n)=F(n/2)+1 if n>1

d) F(M,N)=1 if M=0, or M ≥N ≥1, and F(M,N)=F(M-1,N)+F(M-1,N-1), otherwise.

e) B(m,x)=m!/(x!(m-x)!) where m>x,

B(0,0)=B(m,0)=1 and B(m,x)=B(m,x-1)*[(m-x+1)/x]

 

16. Create a module which contains the functions printing several patterns. Each function will take input the number of rows and/or columns as required.

 

*

* *

* * *

* * * *

* * * * *

 

 

     *

    * *

   * * *

  * * * *

 * * * * *

 

 

    *

   * *

  * * *

 * * * *

* * * * *

 

 

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

 

 

1

2 3

4 5 6

7 8 9 10

11 12 13 14 15


17. Create a package which contains five modules fish, birds, amphibians, mammals, and reptiles. Each module contains two functions example and characteristics.

