Define the following functions,
f(x) = 1 / 1 + x2
and g(x) = x − x2
Produce plots of the graphs of each of f ◦ g and g ◦ f. You should choose settings (eg domain, number of samples) to make a smooth plot which displays the key features - try experimenting with different settings to work out what looks good.
Write a program to print a rectangle pattern of M rows and N columns using the characters as shown below.
+----------+
| |
| |
| |
+----------+
Write a python program which takes a number from the user and prints if it is positive, negative or 0, odd or even and if it is a multiple of 10.
Example 1:
Sample Input:
-70
Sample Output:
Negative even number which is a multiple of 10
Example 2:
Sample Input:
Sample Output:
Input is 0
Example 3:
Sample Input:
11
Sample Output:
Positive odd number which is not a multiple of 10
Write a python program that takes the weight of luggage from the user and prints the total amount the user needs to pay according to the given conditions:
Sample Input - Sample Output
Luggage Weight: 5 Payment: Tk. 200.25
Luggage Weight: 20 Payment: Tk. 701.0
Luggage Weight: 32 Weight crosses maximum limit
Write a Python code of a program that reads a candidate’s ielts score and prints out the corresponding CEFR level for that band score. The score ranges and corresponding CEFR level are shown in the table below.
(Hint: This problem can be solved in two ways: top-down and bottom-up.)
IELTS Score -CEFR Level
8.5-9 C2
7-8 C1
5.5-6.5 B2
4.5-5 B1
4 A2
0- below 4 A1
Example 1:
Sample Input:
IELTS Score: 6
Sample Output:
CEFR Level: B2
Create a program in Python to calculate grade point averages for college students. Grade point averages are calculated by dividing total number of quality points by the total number of earned credit hours. Quality points are grades earned multiplied by the credit hours of a course. A grade of A is worth 4 points, B is 3 points, C is 2 points, D is 1 point and an F is 0 points.
Your program should prompt the student to enter their name, total credit hours earned, and total quality points earned. Calculate the grade point average and display back the student’s name along with their gpa for my example of John Doe.
Hi John Doe. Your grade point average is 3.30.
Consider the following Python function.
def mystery(l):
if l == []:
return(l)
else:
return(mystery(l[1:])+l[:1])What does mystery([22,34,18,57,92,45]) return?
Diamond Crystal
Given an integer value N, write a program to print a diamond pattern of 2*N rows as shown below.
The first line of input is an integer N.
In the given example, the number of rows in the diamond is 2*5 = 10.
So, the output should be
/\
/ \
/ \
/ \
/ \
\ /
\ /
\ /
\ /
\/Sample Input 1
5
Sample Output 1
/\
/ \
/ \
/ \
/ \
\ /
\ /
\ /
\ /
\/Sample Input 2
3
Sample Output 2
/\
/ \
/ \
\ /
\ /
\/Refer to the document in the link below
https://docs.google.com/document/d/1RBknUJ-BqOf7C-5nMxEFs4JxAUQo4_KSt07SSkS3Jak/edit?usp=sharing