#quadratic formula aquad=1 bquad=-6 cquad=5 quadnum1=0-bquad quadnum2=(bquad**2)-(4*aquad*cquad) quadnum3=(quadnum2**.5) quadnumfinal1=quadnum1+quadnum3 quadnumfinal2=quadnum1-quadnum3 quadden1=2*aquad quadfinal1=quadnumfinal1/quadden1 quadfinal2=quadnumfinal2/quadden1 quadformlist=[quadfinal1,quadfinal2] #pythagorean theorem apytrm=1 bpytrm=1 pytrm1=(apytrm**2)+(bpytrm**2) pytrm=pytrm1**.5 #distance formula x1=0 y1=0 x2=3 y2=4 distform1=(x1-x2)**2 distform2=(y1-y2)**2 distform3=distform1+distform2 distanceformula=distform3**2 #physics 1 v01=2 a1=2 t1=5 velocity=v01+(a1*t1) #physics 2 x02=0 v02=2 t2=5 a2=2 dist2=v02*t2 dist3=.5*a2*(t2**2) distance=x02+dist2+dist3 #physics 3 v03=2 a3=2 x03=0 x3=10 velocity3pt1=2*a3*(x3-x03) velocity3=(v03**2)+velocity3pt1 #physics 4 (kinetic energy) m4=5 v4=2 kinetic=.5*m4*(v4**2) #physics 5 (spring potential) k5=100 x5=5 spotential=.5*k5*(x5**2) #greatest common factor def greatest_common_factor(x,y): print "For", x, "and", y,"," r=x%y while r>0: r=x%y if r ==0: print "the greatest common divisor is", y,"." else: q=y x=q y=r #password input print('Hello. Please enter the password.') password=input('') if password==(7437): print('Welcome') else: print('Incorrect Password') if password==(7437): print('What can I do for you?') if password==(7437): program=input('') print('One moment...') if program==1: print(quadformlist) if program==2: print(pytrm) if program==3: print(distanceformula) if program==4: print(velocity) if program==5: print(distance) if program==6: print(velocity3) if program==7: print(kinetic) if program==8: print(spotential) if program==9: print(greatest_common_factor(1071,1029))
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