def password(): while(True): try: usuario=input("ingrese usuario:") password=input("ingrese password:") if(usuario=="examen" and password=="final"): print("welcome to examen final") break else: print("wrong pasword") #"---------------solo menu------------" def menu():# solo seleccion de menu print("ley de ohm") print("(1) resistencia") print("(2) voltaje") print("(3) intensidad") print("(4) potencia") print("(0) salir") #"---------------calculo ley de ohm------------" def resistencia(): while(True): try: print("resistencia") v=float(input("ingrese voltaje:)) i=folat(input("ingrese intensidad:)) resistencia=v*i print("la resistencia es =",resistencia) break except: print("el dato ingresado no es numerico") def voltaje(): while(True): try: print("voltaje") r=float(input("ingrese resistencia:")) i=folat(input("ingrese intensidad:")) voltaje=r*i print("el voltaje es =",voltaje) break except: print("el dato ingresado no es numerico") def intensidad(): while(True): try: print("intensidad") v=float(input("ingrese voltaje:)) r=folat(input("ingrese resistencia:)) intensidad=v/r print("la resistencia es =",resistencia) break except: print("el dato ingresado no es numerico") def potencia(): while(True): try: print("potencia") v=float(input("ingrese voltage:)) i=folat(input("ingrese intensidad:)) potencia=v*i print("la potencia es =",potencia) break except: print("el dato ingresado no es numerico") #"------------programa principal-------------" while(True): #ciclo infinito menu() opcion=input("ingrese opcion") if(opcion=="1"): reistencia() elif(opcion=="2"): voltaje() elif(opcion=="3"): intensidad() elif(opcion=="4"): potencia() elif(opcion=="0"): break else: print("opcion no corresponde") print("hasta pronto")
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