Example HTML page

Python Exercise 3

The following problems are related to functions [Basic concept]

1.

a. write a python code to print the details of two employees i.e. jai, Binish. The details include name,age,qualification,location and salary with out using functions.
b. Write a python script to print above details of two employees using two functions named binish_details, jai_details.For example,if you call binish_details, it print all the details of binish.
c. Write only one function Employee_details and print the details of two employees.

2. Write a function named justification that takes a string ‘s’ as a parameter and print the string in the following format using functions.The total number of characters in the output string should be 41. you can append ‘*’ to reach length of the output string. Note: Only use concatenation and repetition operators.
a. left [ spam**********************************]
b. right [**********************************spam]
c. center [****************spam******************]

3. Write a function named justification that takes a string ‘s’ as a parameter and print the string in the following formats Note: Only use concatenation and repetition operators
a. left [ spam ********************]
b. right [ spam ************spam]
c. center [** **spam** **]

4.Write a function that draws a grid like the following.
+——+——+
|        |       |
|        |       |
|        |       |
+——+——+
|        |       |
|        |       |
|        |       |
+——+——+
Note: Only use print statement and functions.

5. Write a python script to find the area of a square, rectangle, circle, triangle and the volume of a sphere using functions. Note: a*a, l*w, pi*r*r, 0.5*b*h, (4/3)*pi*r*r*r are the formulas sequantially.

6. Mr. Sudhakar has a bank account balance ‘b1’. Use two functions, one is for debit and one is for credit.
a. credit of 1000
b. debit of 2000
c. debit of 1000
d. credit of 5000
Find the remaining balance in his account.

Example HTML page

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest