how much to do these 2 homework assignments
{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" }, "colab": { "name": "Assignment_07.ipynb", "provenance": [], "collapsed_sections": [], "toc_visible": true } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "w6B8GBaK2YxS" }, "source": [ "# Assignment 07 \n", "\n" ] }, { "cell_type": "markdown", "metadata": { "id": "pJwdr_FC-Glo" }, "source": [ "# Project 1\n", "A prime number is a number that is only evenly divisble by itself and 1.\n", "For example, the number 5 is prime because it can only be evenlly divided by 1\n", "and 5. The number 6, however, is not prime because it can be divided evenly\n", "by 2 and 3.\n", "\n", "Write a Boolean function named is_prime which takes an integer as an argument\n", "and returns true if the argument is a prime number, or false otherwise. Use\n", "the function in a program that prompts the user to enter a number and then\n", "prints whether the number is prime." ] }, { "cell_type": "code", "metadata": { "id": "T84UvGE0-y9t" }, "source": [ "# code here" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "PQAH5lOg-MhA" }, "source": [ "# Project 2\n", "Using the is_prime function from exercise 17, write a program that prints\n", "the prime numbers from 1 to 100 each on their own line." ] }, { "cell_type": "code", "metadata": { "id": "YJ_A1pTE-4Qd" }, "source": [ "# code here" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "Gk_hG1-1-RZ-" }, "source": [ "# Project 3\n", "Suppose you have a certain amount of money in a savings account that earns\n", "compound monthly interest, and you want to calculate the amount that you will\n", "have after a specific number of months. The formula is as follows:\n", "f = p * (1 + i)^t\n", "\n", "• f is the future value of the account after the specified time period.\n", "• p is the present value of the account.\n", "• i is the monthly interest rate.\n", "• t is the number of months.\n", "\n", "Write a program that takes the account's present value, monthly interest rate,\n", "and the number of months that the money will be left in the account as three\n", "inputs from the user. The program should pass these values to a function that\n", "returns the future value of the account, after the specified number of months.\n", "the program should print the account's future value." ] }, { "cell_type": "code", "metadata": { "id": "75BVoUoc-73w" }, "source": [ "# code here" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "Hrkqwhhr4Hti" }, "source": [ "#Chapter 6 Files and Exceptions\n" ] }, { "cell_type": "markdown", "metadata": { "id": "I_7K5KykLlXz" }, "source": [ "##Introduction to File Input and Output " ] }, { "cell_type": "markdown", "metadata": { "id": "XQ558qPuLO16" }, "source": [ "Open the file hostdata.txt for reading." ] }, { "cell_type": "code", "metadata": { "id": "bnVSk2_zBL7z" }, "source": [ "# code here" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "oWwaucPdLcJG" }, "source": [ "Open the file winterdata.txt for reading." ] }, { "cell_type": "code", "metadata": { "id": "oHix4SYzLsLZ" }, "source": [ "# code here" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "HK2T_4jzLf4e" }, "source": [ "Store four file objects corresponding to the files winter2003.txt , spring2003.txt, summer2003.txt, and fall2003.txt in the variables winter, spring, summer, and fall (respectively), and open them all for reading." ] }, { "cell_type": "code", "metadata": { "id": "T4N10rSlLtDH" }, "source": [ "# code here" ], "execution_count": null, "outputs": [] }, {