Unit 1 - Lesson 14

14.1.1. Write a program that asks the user for a weight in kilograms and converts it to pounds. There are 2.2 pounds in a kilogram.

kg = int(input("kg: "))
print(f"lb: {kg*2.2}")

14.1.2. Problem Solving - Operators

t = float(input("temp in celsius: "))
print("temp in fahrenheit is", 1.8*t+32.0)

14.1.3. Problem Solving - Operators

a = int(input("a: "))
b = int(input("b: "))
print(f"{a} + {b} = {a+b}")
print(f"{a} - {b} = {a-b}")
print(f"{a} * {b} = {a*b}")
print(f"{a} / {b} = {a/b}")
print(f"{a} ** {b} = {a**b}")
print(f"{a} % {b} = {a%b}")
print(f"{a} // {b} = {a//b}")

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.