10Co6 Cover Work
10Co6 Cover Work
1.2. Get an input from the user, save it as a variable called “name” and then output the
lines 1.1. but replace gorilla with the name the user has input hint you can use
print(“Gorillas are the largest living primates\n”, name) – see what impact this has
1.4. Make use of all the following arithmetic operators: Addition, Subtraction,
Multiplication, Division and Exponentiation. Hint:
https://www.w3schools.com/python/gloss_python_arithmetic_operators.asp
2.0. Selection
2.1. Code a Boolean expression that asks if 10 times 7 is equal to 70 and then prints
success if that is true. Hint:
https://www.w3schools.com/python/gloss_python_if_statement.asp
FALSE
2.4. Print((10 == 5 *2) and (45 != 9 * 5)) will display what and explain why
3.1. Write a program for an arcade game which will print “You win!” 3 times and then
print “Congratulations!” using a for loop
3.2. Write a program to count down from 10 to 0 and display each value on a separate
line
3.3. Write a program which will ask the user which times table they would like to see
displayed. Then get the users and number and show 2 to 12 times table for that
number
3.4. Write a program to ask the user to input two positive integers a and b where a < b.
Print all numbers between a and b inclusive that are divisible by 13
4.2. Use list.append() to add more planets from other solar systems and print the
updated list
4.3. Write a program to ask the user to enter the number of astronauts sent on space
missions in the years 2016 to 2020 e.g. “How many astronauts on space missions in
2016?”
Store the numbers in a list named astronauts (each year being own element)
Print the list and the total number of astronauts sent on space missions from 2016
to 2020.
4.4. Write a statement to initialise a list named totals containing 100 zeros. Hint you can
make a list of 7 zeros by doing the following:
“mylist = [0]*7”
https://www.w3schools.com/python/exercise.asp?filename=exercise_lists1
5.0. Strings
https://www.w3schools.com/python/python_strings.asp
5.1. Run the following code and explain using comments in the code what is happening:
numChars = len(“5 Oak Street Anytown”)
print(numChars)
5.2. Run the following code and explain using comments in the code what is happening:
Print(len(“Mary\nJo”))
5.3. Create a program that asks the user to enter their name and then prints the number
of characters in their name and the first and last characters
5.4. Write a program to ask the user to enter a sentence. Calculate and print the number
of times the letter “e” appears in the sentence
5.6. https://www.w3schools.com/python/python_strings_exercises.asp