CS
  • Home
  • Languages
    • Python >
      • Basics
      • Conditions & Loops
      • Functions and Modules
      • Other Data Types
      • Errors and Exceptions
      • Projects
    • C + + >
      • Basics
      • Functions
      • Conditions & Loops
  • Programs
  • About

Conditions & Loops

1 - If & else Statement
2 - Comparison & Logic Operators
3 - while Loop
4 - For Loop
Exercises
  • Ask a user how their day is, then output different responses based off the input.
  • Ask a user for 2 numbers check if any numbers are even (or odd) and output which numbers are even (or odd).
  • Build a program that adds 2 to a number while the number is less than 10 and output the result.
  • Create a Calculator that will run until the user enters quit. Ask the user for 2 numbers then have the user enter add, subtract, multiply or divide. Print the answer to the user.

Possible Solutions

Ask a user how their day is, then output different responses based off the input.
  • Be creative with your responses
  • Try a nested if statement

    

​Ask a user for 2 numbers check if any numbers are even (or odd) and output which numbers are even (or odd).
  • Nested if statements
  • Separate statements to check each number.

    

Build a program that prints items from a list.

    

Create a Calculator that will run until the user enters quit. Ask the user for 2 numbers then have the user enter add, subtract, multiply or divide. Print the answer to the user.

    
Powered by Create your own unique website with customizable templates.
  • Home
  • Languages
    • Python >
      • Basics
      • Conditions & Loops
      • Functions and Modules
      • Other Data Types
      • Errors and Exceptions
      • Projects
    • C + + >
      • Basics
      • Functions
      • Conditions & Loops
  • Programs
  • About