Created
May 31, 2020 05:35
-
-
Save claudchereji/e1709c12676ffda982becf78e9573f1d to your computer and use it in GitHub Desktop.
temp_converter.py
This file contains hidden or 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
| first = eval(input('Enter a number here: ')) | |
| second = eval(input('Another one here: ')) | |
| third = eval(input('Just one more, I promise: ')) | |
| total = first+second+third | |
| average = first+second+third/3 | |
| print('The total sum of the 3 numbers is: ', total) | |
| print('And the average if the 3 numbers is: ', average) |
This file contains hidden or 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
| num1 = eval(input('Enter the first number here: ')) | |
| num2 = eval(input('Enter the second number here: ')) | |
| print('The average of the two numbers given is', (num1+num2)/2) | |
This file contains hidden or 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
| pounds = eval(input('Enter your weight: ')) | |
| f_pounds = pounds/2.2 | |
| print('You weigh', f_pounds, 'in Kilograms.') | |
This file contains hidden or 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
| x = eval(input('Enter a number: ')) | |
| print(x, x*2, x*3, x*4, x*5, sep='>') |
This file contains hidden or 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
| sq = eval(input('Enter nummber here: ')) | |
| f_sq = sq * sq | |
| print('the square of', sq, 'is', f_sq, end='') | |
| print('.') |
This file contains hidden or 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
| temp = eval(input('Enter a temperature in Celsius:')) | |
| f_temp = 9/5*temp+32 | |
| print('In Fahrenheit, that is', f_temp) | |
| if f_temp > 212: | |
| print('That temperature is above the boiling point.') | |
| if f_temp < 32: | |
| print('That temperature is below the freezing point.') |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Practice from the book "A Practical Introduction To Python Programming"