O GoConqr está de visual novo! Conte para nós o que você achou.

Flashcards

Iteration revision

Helena Frawley Computer Science Inglês 8 flashcards

Flashcards do conjunto (8)

  1. 1Iteration - Lesson 3- Understand and use iteration in an algorithm
    - Write algorithms in pseudocode involving sequence, selection and iteration
    - Trace through given algorithms to explain what they do, correct or complete them
  2. 2What is iteration??Iteration is when parts of an algorithm need repeating
  3. 3What are the two types of iteration statements in python??- FOR... TO ... NEXT
    -WHILE ... DO ... UNTIL
  4. 4Why are FOR loops useful and the most efficient type of loop??A FOR loop can be set for a specific amount of times, so is set up with a start value and a ending value. The loop only ends when the end value is reached. This type of loop is useful for reading values into lists.
  5. 5Example of a FOR loop:Total <- 0(put 0 into it)
    FOR Counter <- 1 TO 7
    MaxTemperature <- USERINPUT
    Add MaxTemperature to Total
    NEXT Counter
    AverageWeeksTemp <- Total/7
    Output (“This week’s average is ”, AverageWeeksTemp)
  6. 6When do you use a WHILE loop??when the number of repetitions/iterations is not known and the actions are only repeated WHILE a given condition is TRUE.
    The condition must be tested at the beginning of the loop.
  7. 7Example of a WHILE loop:emailAddress <- USERINPUT
    While emailAddress does not contain “@”
    Output “Invalid address – please re-enter”
    emailAddress <- USERINPUT
    Endwhile
    Output “Thank you”
  8. 8TIP: to help you understand how while loops work try laying it out as a flowchart where if the user doesn't do something it returns to the beginning.TIP TIP TIP

Informações

Descrição
Iteration revision
Criado por
Helena Frawley
Visualizações
28
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?