import math def calcolaPollici(alt,lar): no_response = "" min_lar = float(24) alt = float(alt) lar = float(lar) if lar < min_lar: no_response = "\nLa sacca non è larga abbastanza!" in_cost = 2.54 in_alt = alt/in_cost in_lar = lar/in_cost sq_alt = in_alt**2 sq_lar = in_lar**2 sq_tot = sq_alt + sq_lar diag = math.sqrt(sq_tot) diag = round(diag,2) diag = "\nDimensione massima del laptop: " + str(diag) if no_response: diag = no_response return diag alt = raw_input("inserisci altezza") lar = raw_input("inserisci larghezza") print calcolaPollici(alt,lar)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question