Skip to content

Commit

Permalink
Created using Colaboratory
Browse files Browse the repository at this point in the history
  • Loading branch information
azaynul10 committed Sep 7, 2023
1 parent 5ac4c88 commit 0a90e57
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions Quiz_1.ipynb
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)}')"
]
}
]
}

0 comments on commit 0a90e57

Please sign in to comment.