GoConqr has a new look! Let us know what you think.

Mind map

lesson 1 AFEC

emily ! English

Map content

lesson 1 AFEC

  1. smart technology is being integrated into a wide range of computing devices and uses built in sensors. These allow the device to use data gathered by the sensor to change its output

    • for example, a light may turn on because it is dark
  2. a conditional statement is defined within the code by starting with an if (if statement)

    • if the condition defined after if is true, then the code is run
      • there must always be an indent on the next line after an if statement
        • where code is selected if the condition is met is called 'selection'
          • an indent can be made with a tab
    • conditional statements must have a colon at the end (including statements with if/else)
  3. user_name = "James" if user_name == "James" print ("Welcome, James!")

    • in this code, if the user_name variable is changed to "Charles", nothing will print.
    • this code will print the text Welcome, James!
  4. hashtag (#) is used for comments in Python (in HTML, enclose text with * for it to become a comment)

  5. there are four data types; booleans (true or false), strings (always have quotation marks around them), integers (whole numbers), and floats (numbers that have a decimal, eg. 2.5)

  6. to turn a light on, use turn_on("light"), in place of light, you can also use other things, such as aircon

    • smart tech allows you to have factors for turning on the light, such as time, like in the code shown below:
      • time = 7
        • if time == 7:
          • turn_on("light")
      • presence_check("light") is another factor to check whether someone is present or not
        • if presence_check("light") == True:
          • turn_on("light")
          • when using presence check, you must specify the object, eg. light, lock
          • with presence check, you do not have to put ==True. You may also write the command like this: if presence_check("light"):. With presence check, if/else can be used. You may say if presence_check("light")==True: (next line) turn_on("light") (next line) else: turn_off("light")
  7. with lights, get_brightness() makes brightness a factor. In the example below, if brightness is below 50, the light will turn on

    • for example, if get_brightness() <50: (next line) turn_on("light"), (next line) else: (next line) turn_off("light")
  8. single equals (=) is for assigning a value to a variable. Double equals (==) means exactly equal. So, variable time may equal (=) 7, but if time ==7, then the time is actually 7(o'clock)

  9. get_temp() is used to state that if get_temp() equals a certain number (eg. 30), the air con will turn on

Information

Description
Mind Map on lesson 1 AFEC, created by emily ! on 02/05/2020.
Created by
emily !
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?