#!/usr/bin/env python # coding: utf-8 # In[14]: print("5-4/2=",5-4/2) # Python follows the standard order of operations # Parentheses first, exponents second, mult/div third, add/subt last print("5*2/2=",5*2/2) print("3^(27)=",3**27) print("27^3=",27**3) print("3**3**3=",3**3**3) print("(3**3)**3=",(3**3)**3) print("3**(3**3)=",3**(3**3)) # Bitwise XOR # print(5^9) print("7329/(60**2)=",7329/(60**2)) print("7329//(60**2)=",7329//(60**2)) # In[27]: # Time converter program # # # Get the total seconds from the user total_seconds=int(input("What are the total number of seconds?")) #print("the type of total_seconds is",type(total_seconds)) # Find the number of hours hours=total_seconds//3600 # Find remaining number of seconds remaining_seconds=total_seconds-3600*hours # Find the number of minutes minutes=remaining_seconds//60 # Find the number of seconds seconds=remaining_seconds-60*minutes # Display the result print("There are",hours,"h",minutes,"m",seconds,"s in a total of",total_seconds,"seconds.") # In[29]: # The Hagen-Poiseuille equation related pressure difference # of an incompressible fluid between lengths of a pipe (Delta p) # to length (L), dynamic viscosity (mu), volumetric flow rate (Q), # and cross sectional radius of the pipe (A) # # Delta p = (8*mu*L*Q)/A^2 # Take inputs for the variables L, mu, Q, and A and output Delta p L=float(input("What is the length?")) mu=float(input("What is the dynamic viscosity?")) Q=float(input("What is the volumetric flow rate?")) A=float(input("What is the cross-sectional area?")) print("The pressure difference Delta p=",(8*mu*L*Q)/(A**2))