Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JainMaster authored Oct 20, 2020
1 parent 0847a40 commit 985befc
Show file tree
Hide file tree
Showing 13 changed files with 940 additions and 0 deletions.
63 changes: 63 additions & 0 deletions 1.Introduction to Python/Arithmetic Progression.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Arithmetic Progression\n",
"You are given first three entries of an arithmetic progression. You have to calculate the common difference and print it.<br>\n",
"<br>\n",
"Input format:<br>\n",
"The first line of input contains an integer a (1 <= a <= 100)<br>\n",
"The second line of input contains an integer b (1 <= b <= 100) <br>\n",
"The third line of input contains an integer c (1 <= c <= 100) <br>\n",
"<br>\n",
"Constraints:<br>\n",
"Time Limit: 1 second<br>\n",
"<br>\n",
"Output format:<br>\n",
"The first and only line of output contains the result. <br>\n",
"<br>\n",
"Sample Input:<br>\n",
"1<br>\n",
"3<br>\n",
"5<br>\n",
"Sample Output:<br>\n",
"2"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"a=int(input())\n",
"b=int(input())\n",
"c=int(input())\n",
"print(b-a)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
61 changes: 61 additions & 0 deletions 1.Introduction to Python/Find X raised to power N.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Find X raised to power N\n",
"You are given two integers: X and N. You have to calculate X raised to power N and print it.<br>\n",
"<br>\n",
"Input format:<br>\n",
"The first line of input contains an integer X (1 <= X <= 100)<br>\n",
"The second line of input contains an integer N (1 <= N <= 10) <br>\n",
"<br>\n",
"Constraints:<br>\n",
"Time Limit: 1 second<br>\n",
"<br>\n",
"Output format:<br>\n",
"The first and only line of output contains the result. <br>\n",
"<br>\n",
"Sample Input:<br>\n",
"10<br>\n",
"4<br>\n",
"Sample Output:<br>\n",
"10000"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"X=int(input())\n",
"N=int(input())\n",
"\n",
"print(X**N)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
65 changes: 65 additions & 0 deletions 1.Introduction to Python/Find average Marks.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Find average Marks\n",
"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",
"<br>\n",
"Input format :<br>\n",
"3 Test marks (in different lines)<br>\n",
"Output format :<br>\n",
"Average<br>\n",
"<br>\n",
"Sample Input 1 :<br>\n",
"3 <br>\n",
"4 <br>\n",
"6<br>\n",
"Sample Output 1 :<br>\n",
"4.333333333333333<br>\n",
"<br>\n",
"Sample Input 2 :<br>\n",
"5 <br>\n",
"10 <br>\n",
"5<br>\n",
"Sample Output 2 :<br>\n",
"6.666666666666667"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sub_1=int(input(\"\"))\n",
"sub_2=int(input(\"\"))\n",
"sub_3=int(input(\"\"))\n",
"Average_of_3_subjects=(sub_1+sub_2+sub_3)\n",
"print(Average_of_3_subjects/3)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
68 changes: 68 additions & 0 deletions 1.Introduction to Python/Rectangular Area.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Rectangular Area\n",
"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",
"<br>\n",
"The end coordinates are provided as four integral values: x1, y1, x2, y2. It is given that x1 < x2 and y1 < y2.<br>\n",
"<br>\n",
"Input format:<br>\n",
"The first line of input contains an integer x1 (1 <= x1 <= 10)<br>\n",
"The second line of input contains an integer y1 (1 <= y1 <= 10) <br>\n",
"The third line of input contains an integer x2 (1 <= x2 <= 10)<br>\n",
"The fourth line of input contains an integer y2 (1 <= y2 <= 10) <br>\n",
"<br>\n",
"Constraints:<br>\n",
"Time Limit: 1 second<br>\n",
"<br>\n",
"Output format:<br>\n",
"The first and only line of output contains the result.<br>\n",
"<br>\n",
"Sample Input:<br>\n",
"1<br>\n",
"1<br>\n",
"3<br>\n",
"3<br>\n",
"Sample Output:<br>\n",
"4"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x1=int(input())\n",
"y1=int(input())\n",
"x2=int(input())\n",
"y2=int(input())\n",
"print((x2-x1)*(y2 - y1))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
104 changes: 104 additions & 0 deletions 2.Conditionals and Loops/Calculator.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Calculator<br>\n",
"<br>\n",
"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",
"<br>\n",
"1. If the input is 1, 2 integers are taken from the user and their sum is printed.<br>\n",
"2. If the input is 2, 2 integers are taken from the user and their difference(1st number - 2nd number) is printed.<br>\n",
"3. If the input is 3, 2 integers are taken from the user and their product is printed.<br>\n",
"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",
"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",
"6. If the input is 6, the program exits.<br>\n",
"7. For any other input, print &quot;Invalid Operation&quot;.<br>\n",
"Note: Each answer in next line.<br>\n",
"<br>\n",
"Input format:<br>\n",
"Take integers as input, in accordance to the description of the question. <br>\n",
"<br>\n",
"Constraints:<br>\n",
"Time Limit: 1 second<br>\n",
"<br>\n",
"Output format:<br>\n",
"The output lines must be as prescribed in the description of the question.<br>\n",
"<br>\n",
"Sample Input:<br>\n",
"3<br>\n",
"1<br>\n",
"2<br>\n",
"4<br>\n",
"4<br>\n",
"2<br>\n",
"1<br>\n",
"3<br>\n",
"2<br>\n",
"7<br>\n",
"6<br>\n",
"Sample Output:<br>\n",
"2<br>\n",
"2<br>\n",
"5<br>\n",
"Invalid Operation"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"while True:\n",
" n = int(input())\n",
" if n == 1:\n",
" n1 = int(input())\n",
" n2 = int(input())\n",
" print(int(n1+n2))\n",
" elif n == 2:\n",
" n1 = int(input())\n",
" n2 = int(input())\n",
" print(int(n1-n2))\n",
" elif n == 3:\n",
" n1 = int(input())\n",
" n2 = int(input())\n",
" print(int(n1*n2))\n",
" elif n == 4:\n",
" n1 = int(input())\n",
" n2 = int(input())\n",
" print(int(n1/n2))\n",
" elif n == 5:\n",
" n1 = int(input())\n",
" n2 = int(input())\n",
" print(int(n1//n2))\n",
" elif n == 6:\n",
" exit()\n",
" else:\n",
" print(\"Invalid Operation\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit 985befc

Please sign in to comment.