SUMMARY FOR. You learned to write simple if statements, if-else chains, and if-elif-else chains FOR PYHTON
Added by Christine S.
Step 1
Sure! Here’s a step-by-step summary of how to write simple if statements, if-else chains, and if-elif-else chains in Python. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 54 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
3.7 Code Practice For this lesson, you will come up with your own challenging algorithm for other students to trace. It must contain at least 5 if statements and use at least one AND or OR boolean condition. Note: Elif or else statements will not count - your statements must be if statements. Each if statement should use a unique variable name.
Akash M.
Which of the following statements will make a selection construct? 1. if 2. if else 3. for 4. While
James K.
Write an if statement that assigns 20 to the variable y and assigns 40 to the variable z if the variable x is greater than 100. Write an if statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. Write an if-else statement that assigns 0 to the variable b if the variable a is less than 10. Otherwise, it should assign 99 to the variable b. Write nested decision structures that perform the following: If amount1 is greater than 10 and amount2 is less than 100, display the greater of amount1 and amount2.
Cora M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD