Python Exercises
Python Exercises
In Python, the command print tells the program to display words or numbers on the
screen. print is a keyword
Exercise 1
What keyword tells Python to display something on the screen?
Exercise 2
Complete the line of code to tell Python to display the name of the oval object laid by a
hen.
print________
Exercise 3
Tell Python to display the letter "e".
Exercise 4
Tell Python to display the name of our planet.
Exercise 5
Tell Python to display the name of the star that makes life possible on earth.
Exercise 6
In a print statement, the characters surrounded by quotation marks are a text _______.
Exercise 7
Tell Python to display the first three letters of the alphabet in upper-case.
Exercise 8
Tell Python to display a string of your choice.
Exercise 9
Tell Python to display your first name.
Exercise 10
Tell Python to display the three-letter word for a canine.
Python Exercise chapter 02
Exercise 1
Because of the quotation marks, Python identifies the greeting below as a _______ .
"Hello, World!"
Exercise 2
Because there are no quotation marks, Python identifies the set of characters below as a
_______.
country_of_origin
Exercise 3
Assign the string "Boo!" to the variable scare.
Exercise 4
Assign the string "jay" to the variable bird.
Exercise 5
Assign your first name to a variable. You choose the variable name.
Exercise 6
Assign a string to a variable. You choose the variable name and the string.
Exercise 7
In the statement below, I assign a string to a variable. Using the variable, write the
statement that displays the string on the screen.
my_name = "Abdul Majeed"
Exercise 8
Assign a string to a variable. You choose the variable name and the string. Using the
variable, write a statement that displays the string on the screen.
Exercise 9
Revise this variable name as the Python governing body recommends.
countryoforigin
Exercise 10
Assign the string "Hi" to the variable greeting.
Python Exercise chapter 03
Exercise 1
There are two correct answers for this one. Answer with either one. What is this?
100
Exercise 2
Type the illegal character in this variable name.
2nd_runner_up
Exercise 3
Assign the number 5 to the variable players
Exercise 4
Assign the negative number -6 to the variable loss.
Exercise 5
What is the value of total?
number = 10
total = number + 2
Exercise 6
Assign a number (your choice) to the variable total.
Exercise 7
Assign a negative integer to a variable. You choose the integer and the variable name.
Exercise 8
What is this (one word, lowercase)?
"-8.087"
Exercise 9
Add two variables and assign the result to a third variable. Make up all the variable names.
Exercise 10
Add 5 to the variable running_total and assign the result to the same variable.
Python Exercise chapter 04