Monday, September 19, 2016

Programming In Class Notes 9/16/16


  • Four Basic Elements of Programming
    • Sequential Execution
      • Top to Bottom
    • Selection
      • Branching
        • Chapter 5
    • Looping, Repetition, While
      • Chapter 7
    • Sub Routine, Function
      • Chapter 3
      • Chapter 6
  • How Do You Divide A Number And Have The Solution Have No Decimals (Floor Division)?
    •  print (first number // second number)
  • How Do You Find The Remainder of Two Numbers Divided By Each Other (Modulus)?
    • first number % second number
  • How Do You Compare Two Variables?
    • To see if they are equal
      • first variable == second variable
    • To see if one is greater than the other
      • first variable > second variable
    • To see if one is less than another
      • first variable < second variable
  • If at least one statement is true in an or statement and the rest are false...
    • The entire statement is true
  • If only one statement is true in an and statement, and the rest are false.....
    • The entire statement is false
  • Or statements are only false if.....
    • All statements involved are false
  • Not Statements are...
    • True when the statement is false
    • False when the statement is true
  • What are the types of True and False?
    • Boolean
  • How Are Strings Organized Like Numbers in Python?
    • Shorter strings are considered less than longer strings
    • Empty strings are the shortest strings that can exist (Empty strings have nothing in them, this is not the same as having a string with spaces in them)
    • Capital letters are considered less than lowercase letters
  • Inequalities
    • Greater than or equal to
      • >=
    • Less than or equal to
      • <=
    • Less than
      • <
    • Greater than
      • >
  • How do you convert a string variable into being uppercase?
    • str.upper(variable name)
  • How do You Write an Else Statement?
    • You write it at the same indentation as the if statement, but right below the if statement
    • else :
  • How do You Write and What is An Else If Statement?
    • You write it below and at the same indentation of an if statement
    • It works as an alternative to the first If statement
    • elif variable name

No comments:

Post a Comment