View sourcecode

The following files exists in this folder. Click to view.

plane1.cgi

1 lines UTF-8 Unix (LF)
1
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
Calculator converting metric system to English system
"""


# To write pagecontent to sys.stdout as bytes instead of string
import sys
import codecs


# Enable debugging of cgi-.scripts
import cgitb
cgitb.enable() 


print("Content-Type: text/plain;charset=utf-8")

print("")

print("""
=======================================================================
|--> Conversion of metric system to English system for flight data <--|
=======================================================================
""")

# Input of data for conversion
height = 1100
speed = 1000
temp = -50

# Conversion of inputed data to EnSystem
EnHeight = int(height) * 3.28084
EnSpeed = int(speed) * 0.62137
EnTemp = int(temp) * 9 / 5 + 32

# Printing of answer
print("""\nAnswer:
===========================""")
print(height, "meters =", int(EnHeight), "feet")
print(speed, "km/h =", int(EnSpeed), "mph")
print(temp, "℃ =", int(EnTemp), "Farenheit")

sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())