cloud/e1.py

32 lines
747 B
Python

from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
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()