cloud/e1.py
Lukasz Tatrocki b999bc02f8 fix
2020-05-07 19:20:38 +02:00

33 lines
781 B
Python

from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
user = {'username': 'Miguel'}
return '''
<html>
<head>
<title>E1</title>
<script>
function count()
{
var text = document.getElementById('text')
var capitals = (text.value.match(/[A-Z]/g) || []).length
var noncapitals = (text.value.match(/[a-z]/g) || []).length
document.getElementById('result').textContent = `duze: ${capitals} male: ${noncapitals}`
}
</script>
</head>
<body>
<input type='text' id='text'/>
<input type='submit' onclick='count()'>
<p id='result'></p>
</body>
</html>'''
if __name__ == '__main__':
app.run()