Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
# Calculator
import sys
infiniteLoop = "true"
while(infiniteLoop == "true"):
operator = input("Would you like to add (a), subtract (s), multiply (m), or divide (d)")
if (operator == "a"):
add1 = raw_input("Enter 1st number: ")
add2 = raw_input("Enter number you would like to add: ")
answer = add1 + add2
print(answer)
newEquation = raw_input("Would you like to enter new equation (e) or continue this one (c), or are you finished (n)?")
if(newEquation == "e"):
continue
else:
break
elif (operator == "s"):
subtract1 = raw_input("Enter 1st number: ")
subtract2 = raw_input("Enter number you would like to subtract: ")
answer = subtract1 - subtract2
print(answer)
newEquation = raw_input("Would you like to enter new equation (e) or continue this one (c), or are you finished (n)?")
if(newEquation == "e"):
continue
else:
break
elif (operator == "m"):
multiply1 = raw_input("Enter 1st number: ")
multiply2 = raw_input("Enter number you would like to add: ")
answer = multiply1 * multiply2
print(answer)
newEquation = raw_input("Would you like to enter new equation (e) or continue this one (c), or are you finished (n)?")
if(newEquation == "e"):
continue
else:
break
elif (operator == "d"):
divide1 = raw_input("Enter 1st number: ")
divide2 = raw_input("Enter number you would like to add: ")
answer = divide1 / divide2
print(answer)
newEquation = raw_input("Would you like to enter new equation (e) or continue this one (c), or are you finished (n)?")
if(newEquation == "e"):
continue
else:
break
else:
print("Sorry, that is not a defined operator")
import numpy as np
import matplotlib.pyplot as plt
import os as os
#deg=0
Cd_deg_0=np.loadtxt('base_de_donne/Re_100_deg_0/x-hydroForce_time.res',delimiter=' ')
Cz_deg_0=np.loadtxt('base_de_donne/Re_100_deg_0/z-hydroForce_time.res',delimiter=' ')
Cd_stable_deg_0=[]
Cz_stable_deg_0=[]
for i in range(len(Cd_deg_0)):
if Cd_deg_0[i,0]>=25.9104 :
Cd_stable_deg_0.append(Cd_deg_0[i,1])
Cz_stable_deg_0.append(Cz_deg_0[i,1])
plt.figure(1)
plt.plot(Cz_stable_deg_0,Cd_stable_deg_0)
plt.show()
userName=raw_input('Please enter your name:')
age=input('Please enter your age:')
factor=2
finalAge=age+factor
multAge=age*factor
divAge=age/factor
print('In', factor, 'years your age will be', finalAge, 'years old', userName)
print('Your age muliply by', factor, 'is', multiAge)
print('Your age divided by', factor, 'is', divAge)
# Hello World program in Python
import requests
result = requests.post('https://openapi.daocloud.io/v1/apps/28832ce5-0e21-42a2-8307-796a85045c3e/actions/restart',
headers={"Authorization": "token q4c67rdvmtmkgee4hwgr3efj2vj0ucw7v74qk6qk"})
print(result.json())