-
Notifications
You must be signed in to change notification settings - Fork 5
/
Celcius Converter.html
66 lines (49 loc) · 2.22 KB
/
Celcius Converter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<title> Celsius To Fahrenheit </title>
<!-- Pyscript -->
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<!--<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />-->
<!-- bootstrap for styling , Pyscript can also be used for styling instead of bootstrap -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous" />
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<style>
body {
background-color: #fcfcfc;
padding-top: 55px;
min-height: 100vh;
margin:0;
display:flex;
flex-direction:column;
}
</style>
</head>
<body>
<!-- write your Python code in py-script tag -->
<py-script>
from js import document,alert
def farh(cel):
return (float(cel) *(9/5)) + 32
def convert(*ags, **kws):
celsius = document.getElementById('celsius').value;
result= farh(celsius)
pyscript.write("Fahrenheit",result)
</py-script>
<div class="container">
<h1 class="text-center">
Celsius to Fahrenheit Converter
</h1>
<br />
<p><h3>Enter Temp in Calsius number:</h3>
<input id="celsius" type="text" class="form-control" aria-label="Large" aria-describedby="inputGroup-sizing-sm" placeholder="Enter Temp in Celsius" /></p>
<center>
<button id="convert" type="submit" class="btn btn-info" pys-onClick="convert">Convert</button>
</center>
<p>
<h4>Result:</h4>
<textarea id="Fahrenheit" class="form-control" rows="2" aria-label="Large" aria-describedby="inputGroup-sizing-sm" placeholder="Result"></textarea></p>
</div>
</body>
</html>