Tutorial_01_Tasks
July 25, 2018
QBUS6850 – Machine Learning for Business
1 Tutorial 1
1.1 Task 1 – Loops
Write a python script to: – Create a list of the following names: david, jess, mark and laura – Loop
over the list – Print the name if the user’s name is not mark
1.2 Task 2 – Guessing Game
Generate a random number between 1 and 10. Ask the user to guess the number until they get it
right. If the user types “exit” then stop the game.
Hint:
To generate a random number use this code
In [5]: import random
a = random.randint(1,10)
2 Task 3 – Hangman
Create a game of hangman. Ask the user for single letter guesses. Limit the number of mistakes
to 10. Display: – the number of mistakes left – the characters they have guessed – the letters they
guessed correctly
1
Tutorial 1
Task 1 – Loops
Task 2 – Guessing Game
Task 3 – Hangman