Amazing People Lesson Plan for 10th Grade Example Students

else statements.

Topic: Amazing people

Objectives & Outcomes

  • Students will be able to write a paragraph about a person they consider to be amazing, using conditional ifelse statements to control the flow of the story.

Materials

  • Text passages about amazing people
  • Chart with the three conditional ifelse statements
  • Pencils and paper for writing

if Statement

An if statement allows us to make decisions in our programs. It can be used to check whether a certain condition is true or false, and execute a piece of code if the condition is true.

The syntax of an if statement is as follows:

if ():

 

elif ():

 

else:

 

Here is an example of an if statement:

if (age > 18):

print ("You are an adult")

else:

print ("You are a child")

Here is another example of an if statement, this time with an else clause:

if (age < 18):

print ("You are a child")

else:

print ("You are an adult")

In the first example, if the age is greater than or equal to 18, then the code in the if statement is executed. If it is not, the code in the else clause is executed.

if (age < 18):

print ("You are a child")

else:

print ("You are an adult")

In the second example, if the age is less than 18, then the code in the if statement is executed. Otherwise, the code in the else clause is executed.

if (age < 18):

print ("You are a child")

else:

print ("You are an adult")

The code in an if statement can be more than one statement. We can also have an else clause, which will be executed if the condition in the if statement is false.

if (age > 18):

print ("You are an adult")

else:

print ("You are a child")

The code in an if statement can also contain elif clauses. An elif clause is used to test for additional conditions, and is executed if the condition in the previous if or elif clause is true.

if (age < 18):

print ("You are a child")

elif (age > 18):

print ("You are an adult")

else:

print("You are an alien")

In this example, if the age is less than 18, then the code in the if statement is executed. If the age is greater than or equal to 18, but not equal to 21, then the code in the elif clause is executed. If the age is greater than 21, then the code in the else clause is executed.

if (age < 18):

print ("You are a child")

elif (age > 18):

print ("You are an adult")

else:

print("You are an alien")

The else clause can be used without an if or elif clause. It is executed if no conditions are true.

if (age < 18):

print ("You are a child")

else:

print("You are an adult")

If no conditions are true, then the code in the else clause is executed.

if (age < 18):

print ("You are a child")

else:

print("You are an adult")

The code in an if statement can also contain else if clauses. An else if clause is

Guidance for Authors

The following guidance is provided for authors of course materials using the Python language.

JavaScript is a scripting language used to add dynamic, interactive elements to webpages.

It was originally created by Brendan Eich at Netscape in 1995, but it is now an open

source language supported by a large number of developers and companies.

It is a popular language for creating educational websites, including interactive

games and other engaging content.

programming language for creating games and other interactive webpages.

Python is a powerful,

Guidance for Authors

The following guidance is provided for authors of course materials using the Python language.

The Python language has many built-in functions and modules that allow us to perform complex tasks. One of the functions that we will be using in this book is the random module. This module contains functions that allow us to generate pseudo-random numbers.We can also use this module to generate random strings.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in our projects.

will be using in

There are a variety of activities in which you can use the Python language.

The following is a list of suggested activities and the corresponding Python

code needed to complete that activity.

1. Creating Random Numbers

In this activity, we will create a program that generates a random number between 0 and 100.

Create a new file in your Python editor and enter the following code:

print(random.randint(0, 100))

When you run this code, you should see a random number between 0 and 100 printed to the screen.

We use the print() function to output information to the screen.

The random.randint(min, max) function generates a random integer between the min and max

parameters. In this case, we want a random number between 0 and 100, so we pass in 0 and 100 to the randint() function.

/*Creating Random Numbers*/

import random

print(random.randint(0, 100))

When you run this code, you should see a random number between 0 and 100 printed to the screen.

The print() function is used to output information to the screen.

The random.randint(min, max) function generates a random integer between the min and max

parameters. In this case, we want a random number between 0 and 100, so we pass in 0 and 100 to the randint() function.

2. Creating a Random String

In this activity, we will create a program that generates a random string with a length

between 5 and 10 characters.

Create a new file in your Python editor and enter the following code:

import random

print(random.choice(['Hello', 'World']) * random.randint(5, 10))

When you run this code, you should see a random string with a length between 5 and 10

characters printed to the screen.

We use the print() function to output information to the screen.

The random.choice(...) function returns a random element from a list. In this case, we

pass in ['Hello', 'World'] to the choice() function, which returns a random element from

the list.

The random.randint(min, max) function generates a random integer between the min and max

parameters. In this case, we want a random string with a length between 5 and 10

characters, so we pass in 5 and 10 to the randint() function.

3. Determining a Random Letter

In this activity, we will create a program that generates a random letter from the

alphabet.

Create a new file in your Python editor and enter the following code:

import random

print(random.choice(['A', 'B', 'C']) * random.choice(['a', 'b', 'c']) * random.

When you run this code, you should see a random letter from the alphabet printed to

the screen.

We use the print() function to output information to the screen.

The random.choice(...) function returns a random element from a list. In this case, we

pass in ['A', 'B', 'C'] to the choice() function, which returns a random element from

the list.

The random.choice(...) function returns a random element from a list. In this case, we

pass in ['a', 'b', 'c'] to the choice() function, which returns a random element from

the list.

The random.random() function returns a random number between 0 and 1. This is multiplied by the random.

function, which returns a random number between 0 and the number passed in.

4. Creating a Random Number Between Two Values

In this activity, we will create a program that generates a random number between 100 and

150.

Create a new file in your Python editor and enter the following code:

import random

print(random.randint(100, 150))

When you run this code, you should see a random number between 100 and 150 printed

to the screen.

We use the print() function to output information to the screen.

The random.randint(min, max) function generates a random integer between the min and max

parameters. In this case, we want a random number between 100 and 150, so we pass in

100 and 150 to the randint() function.

5. Creating a Random Number Between Two Ranges

In this activity, we will create a program that generates a random number between

0 and 100, inclusive of the endpoints.

Create a new file in your Python editor and enter the following code:

import random

print(random.randint(0, 100, 2))

When you run this code, you should see a random number between 0 and 100, inclusive

of the endpoints, printed to the screen.

We use the print() function to output information to the screen.

The random.randint(min, max, num_required) function generates a random integer between

the min and max parameters, but num_required times. In this case, we want a random number

between 0 and 100, inclusive of the endpoints, so we pass in 0, 100, and 2 to the randint()

function. The randint() function returns a random integer between 0 and 99. We then add 1 to

the random number to make it between 1 and 100.

6. Creating a Random Percentage Between Two Values

In this activity, we will create a program that generates a random percentage between 10

and 50.

Create a new file in your Python editor and enter the following code:

import random

print(

print(random.randint(10, 20)))

When you run this code, you should see a random percentage between 10 and 20, inclusive

of the endpoints, printed to the screen.

Create amazing lesson
plans 10X faster with AI.

Use AI to instantly generate high-quality lesson plans in seconds

Try NOW!