{ "cells": [ { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "view-in-github" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "metadata": { "id": "thgO68_HZ0Aa" }, "source": [ "# Introduction" ] }, { "cell_type": "markdown", "metadata": { "id": "PIh3i0c_Z_yP" }, "source": [ "This section introduces the Python Programming uisng Colab. Follow the instructions and complete the exercises." ] }, { "cell_type": "markdown", "metadata": { "id": "gCw6SfeFZ78l" }, "source": [ "# Ex 1 : Check Version" ] }, { "cell_type": "markdown", "metadata": { "id": "6Vm-27iLabjm" }, "source": [ "Using the below cell, Import the required library and check the version of the python in your environment. " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "PJDYHB4AXVdc" }, "outputs": [], "source": [ "import sys\n", "sys.version" ] }, { "cell_type": "markdown", "metadata": { "id": "5qTEiwGlawf5" }, "source": [ "# Ex2 : Convert Currency. " ] }, { "cell_type": "markdown", "metadata": { "id": "XH8K1p0ypVCg" }, "source": [ "Write a program that asks the user for the amount in usd and converts it to British pounds. The exchange rate is from usd to BP is given as 0.82" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "x9xQXOnRa0MS", "outputId": "64294c78-0769-4728-f781-9204a1aa51e3" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "100 usd is equivalent to 82.0 british pound\n" ] } ], "source": [ "usd_amount = input (\"Enter the amount in USD: \")\n", "bp_amount = int(usd_amount) *0.82\n", "\n", "print(\"{} usd is equivalent to {} british pound\".format(usd_amount, bp_amount))" ] }, { "cell_type": "markdown", "metadata": { "id": "ePfECwUIpli4" }, "source": [ "# Ex 3: Temperature Converter" ] }, { "cell_type": "markdown", "metadata": { "id": "Y60hUWDsp3pK" }, "source": [ "Write a program that convert temperature in Feranhite to celsius. " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "G9PbO6qPoUfn" }, "outputs": [], "source": [ "temp_F = input(\"Enter temperatre in F: \")\n", "temp_C = (int(temp_F)-32)*5/9\n", "\n", "print(\"{} Feranhite is equal to {:.2f} Celsius\".format(temp_F, temp_C))\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "id": "a2kNRO9Vp7Qz" }, "source": [ "# Ex 4: Daily Maths" ] }, { "cell_type": "markdown", "metadata": { "id": "lItKon9qqEUn" }, "source": [ "You are working in a retail shop. Write a program that computes the total cost for a customer that bought 3 differnt types of fruits : apple, orange, mango. Ask the user to enter the quantity and price for each type. " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "mIQFjH6wqDma" }, "outputs": [], "source": [ "apple_qty = input(\"Enter number of apples : \")\n", "apple_price = input (\"Price per apple: \")\n", "\n", "orange_qty = input(\"Enter number of oranges : \")\n", "orange_price = input (\"Price per orange: \")\n", "\n", "mango_qty = input(\"Enter number of mangoes : \")\n", "mango_price = input (\"Price per mango: \")\n", "\n", "total_cost = int(apple_qty)*int(apple_price) + int(orange_qty)*int(orange_price) + int(mango_qty)*int(mango_price)\n", "print(\"Total cost is : \", total_cost)" ] }, { "cell_type": "markdown", "metadata": { "id": "31fXlmEQqgvW" }, "source": [ "# Ex 5 : Greeting" ] }, { "cell_type": "markdown", "metadata": { "id": "zvnmj8MGrJIw" }, "source": [ "Write a program to greet the customer who provides the user name. Your program should ask the name of the customer and print \"Hello + customer name\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "Z6ynxZMarIXh" }, "outputs": [], "source": [ "name = input (\"Enter your name: \")\n", "print(\"Hello \" + name)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "colab": { "collapsed_sections": [], "include_colab_link": true, "name": "Ex1_Python.ipynb", "provenance": [] }, "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.12.1" } }, "nbformat": 4, "nbformat_minor": 1 }