Python Tasks

Task One: Random Number Game with Functions

  • The user has to guess a random number.

  • If their guess is higher than the random number, a function repeats the word ‘TOO HIGH’ five times.

  • If their guess is lower than the random number, a function repeats the word ‘TOO LOW’ ten times.

  • If their guess is correct, another function repeats the word ‘WINNER’ twenty times.

Task Two: Authentication Program with Functions

  • User has to enter a username.

  • If their Username is incorrect, run a function that gets them to keep entering it until correct.

  • When the username is correct, the user has to enter a password. A function will only allow them to enter it incorrectly three times before exiting.

  • When both the username and password has been entered correctly, display ‘CORRECT LOGIN’

Task Three: Highest and Lowest in a List with Functions

  • Write a function that takes a list of numbers and works out the highest, lowest and average values.