Created
September 29, 2017 13:34
-
-
Save JJRyan0/e7b8de47c15b2cb68d1248d3af96ea95 to your computer and use it in GitHub Desktop.
Conversion Examples.ipynb
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
{ | |
"cells": [ | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Python Programs to Convert Values -\nJohn Joseph Ryan NCI " | |
}, | |
{ | |
"metadata": { | |
"collapsed": false, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "#Program that transforms EUR in Eurocent\nfrom IPython.display import Latex\neurInput = raw_input(\"Enter EUR input value: \")\neurInputfloat = float(eurInput)\neurCentOutput = eurInputfloat *100\nprint (\" {1} Cents in Eur {0}\".format (eurInputfloat, eurCentOutput))", | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": "Enter EUR input value: 23\n 2300.0 Cents in Eur 23.0\n" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"collapsed": false, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "#Program to convert A EUR value to Cents with input Eur 456.7\neurinput = raw_input(\"Enter Eur input Value: \")\neurfloat = float(eurinput)\neurCentoutput = eurfloat*100\nprint (\" {1} Cents in Eur {0}\".format (eurfloat, eurCentoutput))\n", | |
"execution_count": 54, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": "Enter Eur input Value 456.7\n 45670.0 Cents in Eur 456.7\n" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"collapsed": false, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "#Program input Eur 34.76\neurinput = raw_input(\"enter value: \")\neurfloat = float(eurinput)\neuroutput = eurfloat*100\nprint(\" {0} eur is equal to {1} cents\".format(eurfloat, eurCentoutput))", | |
"execution_count": 58, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": "enter value: 34.6\n 34.6 eur is equal to 45670.0 cents\n" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"collapsed": false, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "#Program that converts temp from celcius to fahrenheit\ncelinput = raw_input(\"Enter degress Celcius: \")\ncelfloat = float(celinput)\nceloutput = 9/5*celfloat +32\nprint (\" {0} degrees celcius is equal to {1} degrees Fahrenheit\".format(celfloat, celoutput)", | |
"execution_count": 60, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": "Enter degress Celcius: 34.6\n 34.6 degrees celcius is equal to 94.28 degrees Fahrenheit\n" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"scrolled": false, | |
"collapsed": false, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "#Program that calcualtes a persons age in 2020\nageinput = raw_input(\"Enter age: \")\nageint = int(ageinput)\nageoutput = ageint+4 \nprint(\" Based on your current age of {0} as of 2016 your age in 2020 will be {1}\".format(ageint, ageoutput))", | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": "Enter age: 25\n Based on your current age of 25 as of 2016 your age in 2020 will be 29\n" | |
} | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"name": "python2", | |
"display_name": "Python 2", | |
"language": "python" | |
}, | |
"language_info": { | |
"mimetype": "text/x-python", | |
"nbconvert_exporter": "python", | |
"name": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.11", | |
"file_extension": ".py", | |
"codemirror_mode": { | |
"version": 2, | |
"name": "ipython" | |
} | |
}, | |
"gist": { | |
"id": "", | |
"data": { | |
"description": "Conversion Examples.ipynb", | |
"public": true | |
} | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment