The document outlines key concepts related to conditional control structures in programming, particularly using Python. It explains various statements such as if, elif, and else, along with their functions and how to implement them in code. Additionally, it includes examples of programs and flowchart creation, emphasizing the importance of problem analysis before algorithm development.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
10 views2 pages
Ict 10 2
The document outlines key concepts related to conditional control structures in programming, particularly using Python. It explains various statements such as if, elif, and else, along with their functions and how to implement them in code. Additionally, it includes examples of programs and flowchart creation, emphasizing the importance of problem analysis before algorithm development.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
POINTERS TO REVIEW / SUMMARY TO REVIEW
THIRD PERIODICAL EXAMINATION
ICT 10
Conditional Control Structure - It is used in programs to perform statements based on
the conditions. Statement - This are provided after the condition. Decision Box - It has the condition answered by true or false. Algorithm - It is a procedure created to instruct the computer what steps to perform to achieve the operation objectives. The flowchart symbol used to add decision to a flowchart is - The first step when creating a program is – Analyzing the problem if x = 2 ; y = 3 z = x * y print (z) – Output: 6 Example of working condition using the if statement in Python - if number <20.5: print ()- It is a function used to display the output data on the screen. F5 - The short key to run the program. Python Idle - It is a separate window that enters the program codes. Python Shell - It displays the output of the program. Statements - These are provided after the condition. if - It is the reserved word that starts the if statement. Our program will run using the – Python Shell To test our program, we choose the run menu followed by run module Operators - These are placed in the condition in the if block. List - It contains elements arranged in a particular order. if-elif-else statement - It evaluates multiple conditions one at a time. if statement - This sets the condition that can be evaluated as true or false. Nested if statement - It is used in creating levels of nesting conditions. if-else statement - It is statement that adds another statement when the condition is false. When adding another condition, we use elif To print a list, we use print () Comments - This included in the codes to create a user-friendly program. input () - The function that used to define the value of variables. And - It performs the value if all conditions are satisfied. Or - It performs the true value if at least one condition or all conditions are satisfied. Not - It performs the true value if the condition is not satisfied. IF statements - executes code conditionally If the IF condition is false - ELSE block executes Nested IF statements - Execute both IF blocks conditionally The purpose of an IF statement - Execute code conditionally The purpose of the If-ELSE statement - Execute code when IF condition is false ELIF statement/s can be used - Multiple Operator tests multiple conditions and returns TRUE if any are TRUE - or To create an empty list, we use – list = [] Python function displays a list – print () To add operation of new element to a list, we use – append
Problem analysis comes first before creating the algorithm.
A conditional control structure has statement after the conditions. Algorithm created through pseudocode or flowchart. A flowchart cannot be in any direction. code=>”hello” is a correct condition. And, or, and not are examples of logical operators. A program is run through the Python shell. A condition ends with a colon (:). Statements are not aligned with the condition. A colon is placed after the condition.
A. Create a program that asks the user to enter his/her PIN. The program displays a message if the PIN is correct. Else, it displays another message if the PIN is incorrect. Print the output.
B. Print the output of the given program.
hps = 10 passingscore = 7.5 score = float(input(“please enter your score: “)) if score > hps: print(“Score is out of range.”) elif score ==hps: print(“You got a perfect score!”) elif score >= passingscore: print(“You passed the quiz!”) else: print(“Oops. Do better next time.”)