Skip to content

Commit 985befc

Browse files
author
JainMaster
authored
Add files via upload
1 parent 0847a40 commit 985befc

13 files changed

+940
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Arithmetic Progression\n",
8+
"You are given first three entries of an arithmetic progression. You have to calculate the common difference and print it.<br>\n",
9+
"<br>\n",
10+
"Input format:<br>\n",
11+
"The first line of input contains an integer a (1 <= a <= 100)<br>\n",
12+
"The second line of input contains an integer b (1 <= b <= 100) <br>\n",
13+
"The third line of input contains an integer c (1 <= c <= 100) <br>\n",
14+
"<br>\n",
15+
"Constraints:<br>\n",
16+
"Time Limit: 1 second<br>\n",
17+
"<br>\n",
18+
"Output format:<br>\n",
19+
"The first and only line of output contains the result. <br>\n",
20+
"<br>\n",
21+
"Sample Input:<br>\n",
22+
"1<br>\n",
23+
"3<br>\n",
24+
"5<br>\n",
25+
"Sample Output:<br>\n",
26+
"2"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": null,
32+
"metadata": {},
33+
"outputs": [],
34+
"source": [
35+
"a=int(input())\n",
36+
"b=int(input())\n",
37+
"c=int(input())\n",
38+
"print(b-a)"
39+
]
40+
}
41+
],
42+
"metadata": {
43+
"kernelspec": {
44+
"display_name": "Python 3",
45+
"language": "python",
46+
"name": "python3"
47+
},
48+
"language_info": {
49+
"codemirror_mode": {
50+
"name": "ipython",
51+
"version": 3
52+
},
53+
"file_extension": ".py",
54+
"mimetype": "text/x-python",
55+
"name": "python",
56+
"nbconvert_exporter": "python",
57+
"pygments_lexer": "ipython3",
58+
"version": "3.8.6"
59+
}
60+
},
61+
"nbformat": 4,
62+
"nbformat_minor": 4
63+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Find X raised to power N\n",
8+
"You are given two integers: X and N. You have to calculate X raised to power N and print it.<br>\n",
9+
"<br>\n",
10+
"Input format:<br>\n",
11+
"The first line of input contains an integer X (1 <= X <= 100)<br>\n",
12+
"The second line of input contains an integer N (1 <= N <= 10) <br>\n",
13+
"<br>\n",
14+
"Constraints:<br>\n",
15+
"Time Limit: 1 second<br>\n",
16+
"<br>\n",
17+
"Output format:<br>\n",
18+
"The first and only line of output contains the result. <br>\n",
19+
"<br>\n",
20+
"Sample Input:<br>\n",
21+
"10<br>\n",
22+
"4<br>\n",
23+
"Sample Output:<br>\n",
24+
"10000"
25+
]
26+
},
27+
{
28+
"cell_type": "code",
29+
"execution_count": null,
30+
"metadata": {},
31+
"outputs": [],
32+
"source": [
33+
"X=int(input())\n",
34+
"N=int(input())\n",
35+
"\n",
36+
"print(X**N)"
37+
]
38+
}
39+
],
40+
"metadata": {
41+
"kernelspec": {
42+
"display_name": "Python 3",
43+
"language": "python",
44+
"name": "python3"
45+
},
46+
"language_info": {
47+
"codemirror_mode": {
48+
"name": "ipython",
49+
"version": 3
50+
},
51+
"file_extension": ".py",
52+
"mimetype": "text/x-python",
53+
"name": "python",
54+
"nbconvert_exporter": "python",
55+
"pygments_lexer": "ipython3",
56+
"version": "3.8.6"
57+
}
58+
},
59+
"nbformat": 4,
60+
"nbformat_minor": 4
61+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Find average Marks\n",
8+
"Write a program to input marks of three tests of a student (all integers). Then calculate and print the average of all test marks.<br>\n",
9+
"<br>\n",
10+
"Input format :<br>\n",
11+
"3 Test marks (in different lines)<br>\n",
12+
"Output format :<br>\n",
13+
"Average<br>\n",
14+
"<br>\n",
15+
"Sample Input 1 :<br>\n",
16+
"3 <br>\n",
17+
"4 <br>\n",
18+
"6<br>\n",
19+
"Sample Output 1 :<br>\n",
20+
"4.333333333333333<br>\n",
21+
"<br>\n",
22+
"Sample Input 2 :<br>\n",
23+
"5 <br>\n",
24+
"10 <br>\n",
25+
"5<br>\n",
26+
"Sample Output 2 :<br>\n",
27+
"6.666666666666667"
28+
]
29+
},
30+
{
31+
"cell_type": "code",
32+
"execution_count": null,
33+
"metadata": {},
34+
"outputs": [],
35+
"source": [
36+
"sub_1=int(input(\"\"))\n",
37+
"sub_2=int(input(\"\"))\n",
38+
"sub_3=int(input(\"\"))\n",
39+
"Average_of_3_subjects=(sub_1+sub_2+sub_3)\n",
40+
"print(Average_of_3_subjects/3)"
41+
]
42+
}
43+
],
44+
"metadata": {
45+
"kernelspec": {
46+
"display_name": "Python 3",
47+
"language": "python",
48+
"name": "python3"
49+
},
50+
"language_info": {
51+
"codemirror_mode": {
52+
"name": "ipython",
53+
"version": 3
54+
},
55+
"file_extension": ".py",
56+
"mimetype": "text/x-python",
57+
"name": "python",
58+
"nbconvert_exporter": "python",
59+
"pygments_lexer": "ipython3",
60+
"version": "3.8.6"
61+
}
62+
},
63+
"nbformat": 4,
64+
"nbformat_minor": 4
65+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Rectangular Area\n",
8+
"You are given a rectangle in a plane. The corner coordinates of this rectangle is provided to you. You have to print the amount of area of the plane covered by this rectangles.<br>\n",
9+
"<br>\n",
10+
"The end coordinates are provided as four integral values: x1, y1, x2, y2. It is given that x1 < x2 and y1 < y2.<br>\n",
11+
"<br>\n",
12+
"Input format:<br>\n",
13+
"The first line of input contains an integer x1 (1 <= x1 <= 10)<br>\n",
14+
"The second line of input contains an integer y1 (1 <= y1 <= 10) <br>\n",
15+
"The third line of input contains an integer x2 (1 <= x2 <= 10)<br>\n",
16+
"The fourth line of input contains an integer y2 (1 <= y2 <= 10) <br>\n",
17+
"<br>\n",
18+
"Constraints:<br>\n",
19+
"Time Limit: 1 second<br>\n",
20+
"<br>\n",
21+
"Output format:<br>\n",
22+
"The first and only line of output contains the result.<br>\n",
23+
"<br>\n",
24+
"Sample Input:<br>\n",
25+
"1<br>\n",
26+
"1<br>\n",
27+
"3<br>\n",
28+
"3<br>\n",
29+
"Sample Output:<br>\n",
30+
"4"
31+
]
32+
},
33+
{
34+
"cell_type": "code",
35+
"execution_count": null,
36+
"metadata": {},
37+
"outputs": [],
38+
"source": [
39+
"x1=int(input())\n",
40+
"y1=int(input())\n",
41+
"x2=int(input())\n",
42+
"y2=int(input())\n",
43+
"print((x2-x1)*(y2 - y1))"
44+
]
45+
}
46+
],
47+
"metadata": {
48+
"kernelspec": {
49+
"display_name": "Python 3",
50+
"language": "python",
51+
"name": "python3"
52+
},
53+
"language_info": {
54+
"codemirror_mode": {
55+
"name": "ipython",
56+
"version": 3
57+
},
58+
"file_extension": ".py",
59+
"mimetype": "text/x-python",
60+
"name": "python",
61+
"nbconvert_exporter": "python",
62+
"pygments_lexer": "ipython3",
63+
"version": "3.8.6"
64+
}
65+
},
66+
"nbformat": 4,
67+
"nbformat_minor": 4
68+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Calculator<br>\n",
8+
"<br>\n",
9+
"Write a program that performs the tasks of a simple calculator. The program should first take an integer as input and then based on that integer perform the task as given below.<br>\n",
10+
"<br>\n",
11+
"1. If the input is 1, 2 integers are taken from the user and their sum is printed.<br>\n",
12+
"2. If the input is 2, 2 integers are taken from the user and their difference(1st number - 2nd number) is printed.<br>\n",
13+
"3. If the input is 3, 2 integers are taken from the user and their product is printed.<br>\n",
14+
"4. If the input is 4, 2 integers are taken from the user and the quotient obtained (on dividing 1st number by 2nd number) is printed.<br>\n",
15+
"5. If the input is 5, 2 integers are taken from the user and their remainder(1st number mod 2nd number) is printed.<br>\n",
16+
"6. If the input is 6, the program exits.<br>\n",
17+
"7. For any other input, print &quot;Invalid Operation&quot;.<br>\n",
18+
"Note: Each answer in next line.<br>\n",
19+
"<br>\n",
20+
"Input format:<br>\n",
21+
"Take integers as input, in accordance to the description of the question. <br>\n",
22+
"<br>\n",
23+
"Constraints:<br>\n",
24+
"Time Limit: 1 second<br>\n",
25+
"<br>\n",
26+
"Output format:<br>\n",
27+
"The output lines must be as prescribed in the description of the question.<br>\n",
28+
"<br>\n",
29+
"Sample Input:<br>\n",
30+
"3<br>\n",
31+
"1<br>\n",
32+
"2<br>\n",
33+
"4<br>\n",
34+
"4<br>\n",
35+
"2<br>\n",
36+
"1<br>\n",
37+
"3<br>\n",
38+
"2<br>\n",
39+
"7<br>\n",
40+
"6<br>\n",
41+
"Sample Output:<br>\n",
42+
"2<br>\n",
43+
"2<br>\n",
44+
"5<br>\n",
45+
"Invalid Operation"
46+
]
47+
},
48+
{
49+
"cell_type": "code",
50+
"execution_count": null,
51+
"metadata": {},
52+
"outputs": [],
53+
"source": [
54+
"while True:\n",
55+
" n = int(input())\n",
56+
" if n == 1:\n",
57+
" n1 = int(input())\n",
58+
" n2 = int(input())\n",
59+
" print(int(n1+n2))\n",
60+
" elif n == 2:\n",
61+
" n1 = int(input())\n",
62+
" n2 = int(input())\n",
63+
" print(int(n1-n2))\n",
64+
" elif n == 3:\n",
65+
" n1 = int(input())\n",
66+
" n2 = int(input())\n",
67+
" print(int(n1*n2))\n",
68+
" elif n == 4:\n",
69+
" n1 = int(input())\n",
70+
" n2 = int(input())\n",
71+
" print(int(n1/n2))\n",
72+
" elif n == 5:\n",
73+
" n1 = int(input())\n",
74+
" n2 = int(input())\n",
75+
" print(int(n1//n2))\n",
76+
" elif n == 6:\n",
77+
" exit()\n",
78+
" else:\n",
79+
" print(\"Invalid Operation\")"
80+
]
81+
}
82+
],
83+
"metadata": {
84+
"kernelspec": {
85+
"display_name": "Python 3",
86+
"language": "python",
87+
"name": "python3"
88+
},
89+
"language_info": {
90+
"codemirror_mode": {
91+
"name": "ipython",
92+
"version": 3
93+
},
94+
"file_extension": ".py",
95+
"mimetype": "text/x-python",
96+
"name": "python",
97+
"nbconvert_exporter": "python",
98+
"pygments_lexer": "ipython3",
99+
"version": "3.8.6"
100+
}
101+
},
102+
"nbformat": 4,
103+
"nbformat_minor": 4
104+
}

0 commit comments

Comments
 (0)