SlideServe
Menu
Préférences
© SlideServe · v2026

Programming

guido avatar
16 diapositives · 269 Views · Jul 31, 2014

Understand and implement branching statements, indenting, and boolean operators in Python programming. Practice writing IF...THEN...ELSE statements and create truth tables. Save programs as Truth_Table_And and Truth_Table_Or.

Programming - slide 1
01 / 16Programming
1 / 17

Télécharger la présentation

Programming
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Programming In Lesson 4

  2. Recap • Complete the starter activity

  3. Objectives • Understand a branching statement (if .. then .. else) • Understand about indenting and blocks of statements • Able to use a function to create a truth table Outcomes • All-Level 4 written code using if..then..else - with help written a truth table in code • Most-Level 5 Be able to write a these with little help. • Some-Level 6 Independently write these and adapt them and complete one of the extension tasks.

  4. Operators

  5. Condition Operators

  6. The If Statement • The basic if statement is this. • If statements are one of the building blocks of programming.

  7. If statements • Copy this on the board. – save it in lesson 4 as my_if • Run the program

  8. If…ELSE … statements Add these 2 lines Copy this on the board. – save it in lesson 4 as my_else Student to explain?

  9. Indenting Try this? What happens now with the IF statement Block

  10. Indenting Try this? What happens now with the IF statement Block

  11. Boolean Operators aka TRUTH TABLES • I could tell you about these….but you would probably forget. • Lets write a python program to teach you. • Remember Boolean variables can be either True or False. What happens when we get 2 together such as • >>> a = True • >>> b = False • What is the result for a AND b? • Back to our program.

  12. The truth tables • Write a program to: • Use the get_user_input_booleanfunction in lesson 4 folder to help you. • Open the function and use it in your program such as a = get_user_boolean_input () This asks the user to enter either True or False • Display the value of variable a and variable b • Display the result of a and b (the operator AND) • You willneed this program later so save it as Truth_Table_And

  13. The solution

  14. Truth Table Or • Write another program to display the result of a or b • Save it as Truth_Table_Or • Amend this program so that it asks the user which table they want to use

  15. Plenary • Try the plenary quiz in my documents -> python -> folder 4

  16. Fun Time • Open the Turtle_intro python program and read the comments. • Just have fun or…. • Try to create …. • A blue box • With a green circle in it • With your initials on top of the box. • An easter egg….