Skip to content

Instantly share code, notes, and snippets.

@claudchereji
Created May 31, 2020 05:35
Show Gist options
  • Save claudchereji/e1709c12676ffda982becf78e9573f1d to your computer and use it in GitHub Desktop.
Save claudchereji/e1709c12676ffda982becf78e9573f1d to your computer and use it in GitHub Desktop.
temp_converter.py
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)
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)
pounds = eval(input('Enter your weight: '))
f_pounds = pounds/2.2
print('You weigh', f_pounds, 'in Kilograms.')
x = eval(input('Enter a number: '))
print(x, x*2, x*3, x*4, x*5, sep='>')
sq = eval(input('Enter nummber here: '))
f_sq = sq * sq
print('the square of', sq, 'is', f_sq, end='')
print('.')
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.')
@claudchereji
Copy link
Author

Practice from the book "A Practical Introduction To Python Programming"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment