Lesson 22: Working with dates and converter between Fahrenheit and Celsius

Post date: Apr 12, 2018 5:09:55 AM

from datetime import datetime

now = datetime.now()

print(now)

mm = str(now.month)

print(mm)

dd = str(now.day)

print(mm + "/" + dd)

yyyy = str(now.year)

print(mm + "/" + dd + "/" + yyyy)

hour = str(now.hour)

print(mm + "/" + dd + "/" + yyyy + " " + hour)

mi = str(now.minute)

print(mm + "/" + dd + "/" + yyyy + " " + hour + ":" + mi)

ss = str(now.second)

print(mm + "/" + dd + "/" + yyyy + " " + hour + ":" + mi + ":" + ss)

import geocoder

g = geocoder.ip('me')

print(g.latlng)

Celsius = float(input("Celsius:"))

Fahrenheit = 9/5 * Celsius + 32

print(Fahrenheit, "Fahrenheit")

Fahrenheit = float(input("Fahrenheit:"))

Celsius = (Fahrenheit - 32)*5/9

print(Celsius, "C")