Multumusc, dar am dat de alta problema Rezultatul e gresit, si nu imi dau seama de ce Insert distance: 10 Insert the distance type: km Insert the number of minutes: 60 Insert the number of seconds: 0 16.1 kilometers per hour 10.0 miles per hour
Buna! Acesta este primul meu thread de pe rstcenter. Vreau sa creez un program in Python 3.2 care sa calculeze viteza in mile pe ora si kilometri dar functia print imi da batai de cap. Cum pot sa printez o variabila integer si un text in acelasi print? Am incercat sa fac si o variabila string dar nu a mers. def mph(): dis=int(input("Insert distance: ")) distype=input("Miles or Kilometers?") minutes=int(input("Insert the number of minutes: ")) secs=int(input("Insert the number of seconds")) time = (minutes + (secs/60))/60 if distype == "miles" or "Miles" or "Mil" or "mil": speedinkm = (dis * 1.61)/time speedinmiles = dis / time if distype == "Kilometer" or "Kilometers" or "kilometer" or "Kilometer" or "km" or "Km": speedinmil = (dis / 1.61)/time speedinkm = dis / time kmh=" kilometers per hour" mph=" miles per hour" print (speedinkm + kmh) print (speedinmil + mph) mph()