Monday, September 26, 2016

Programming In Class Notes


  • How Do You Raise "e" to a power?
    • math.exp(number value)
  • What function represents pi in python?
    • math.pi
  • How do you find the absolute value of a number?
    • abs(number value)
  • When does None occur?
    • When you print an undefined variable
  • What Function Finds Distance?
    • distance(number value, number value, number value, number value)
  • What Function Finds a Squareroot?
    • math.sqrt(numbervalue)
  • What displays the value of a function's calculation?
    • return variable name
  • How do you check to see if a number can be evenly divided by another?
    • number % number
      • If the solution is equal to zero
  • return bool (0)
    • Will Give You False
  • return bool (any non-zero number)
    • Will Give You True
  • return bool("string")
    • Will Give You True
  • return bool("")
    • Will Give You False
  • If you place not in front of a boolean function, whenever it prints true or false, it is printing the opposite of what it actually is
  • Be careful using float numbers, they are not exact, they are approximate 

No comments:

Post a Comment