-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{ | ||
"nbformat": 4, | ||
"nbformat_minor": 0, | ||
"metadata": { | ||
"colab": { | ||
"provenance": [], | ||
"authorship_tag": "ABX9TyOK+rx43TwHHZdwK5n29hfF", | ||
"include_colab_link": true | ||
}, | ||
"kernelspec": { | ||
"name": "python3", | ||
"display_name": "Python 3" | ||
}, | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "view-in-github", | ||
"colab_type": "text" | ||
}, | ||
"source": [ | ||
"<a href=\"https://colab.research.google.com/github/azaynul10/Assignments-Of-Programming-Language-1/blob/main/Quiz_1.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"Write a python program for a 'weird shop' that asks the number of items bought by a customer. Then, it asks the price of each item. The shop applies a 15% vat on the items of even price only. Calculate and print the original price and the price after applying vat.\n", | ||
"\n", | ||
"**Sample Input** :\n", | ||
"\n", | ||
"4\n", | ||
"\n", | ||
"86\n", | ||
"\n", | ||
"189\n", | ||
"\n", | ||
"108\n", | ||
"\n", | ||
"399\n", | ||
"\n", | ||
"**Sample Output:**\n", | ||
"\n", | ||
"Total price: 781\n", | ||
"\n", | ||
"Price after vat: 811.1" | ||
], | ||
"metadata": { | ||
"id": "7FIBUp0yfiBC" | ||
} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/" | ||
}, | ||
"id": "e5tudQB0ViUn", | ||
"outputId": "5420a2af-1014-4726-dd52-7c4acf0b647f" | ||
}, | ||
"outputs": [ | ||
{ | ||
"output_type": "stream", | ||
"name": "stdout", | ||
"text": [ | ||
"Enter a number: 4\n", | ||
"Enter the price: 86\n", | ||
"Enter the price: 189\n", | ||
"Enter the price: 108\n", | ||
"Enter the price: 399\n", | ||
"Total price: 782\n", | ||
"Price after vat: 811.1\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"Sum=0\n", | ||
"num=int(input(\"Enter a number: \"))\n", | ||
"even_price=0\n", | ||
"for i in range(num):\n", | ||
" price=int(input(\"Enter the price: \"))\n", | ||
" Sum+=price\n", | ||
" if price%2==0:\n", | ||
" even_price+=price\n", | ||
" else:\n", | ||
" pass\n", | ||
"print(f'Total price: {Sum}')\n", | ||
"print(f'Price after vat: {Sum+(even_price*0.15)}')" | ||
] | ||
} | ||
] | ||
} |