Ask Python Expert

Assignment Overview

You are required to design and implement an "English Test" program in which the user is presented with a word and then asked to answer a simple question about the word. After 5 words, the program shows the user's score and ends.

The 5 words are selected at random from the list of words in the starter file (english_test.py) provided to you with this assignment brief. Please use the starter file as the basis of your assignment code.

For each of the 5 words, the program randomly selects one of the following 4 questions to ask:

1) How many letters does the word contain?

2) How many vowels does the word contain?

3) How many consonants does the word contain?

4) What is letter # of the word? (# is a number, e.g. "What is letter 3 of the word?")

The entirety of this program can be implemented in under 125 lines of code (although implementing CSP5110 or optional additions may result in a program longer than this) - Ask your tutor for advice if you feel your program is unusually long or inefficient.

Program Requirements

The requirements begin where the starter file ends - after defining the "candidateWords" list. In the following information, numbered points describe a requirement of the program, and bullet points (in italics) are additional details, notes and hints regarding the requirement. Ask your tutor if you do not understand the requirements or would like further information.

1. Print a welcome message, and then set up the test by creating a list of 5 randomly selected words from candidateWords. Also create an integer variable for the user's score (set it to 0).
- This assignment brief will assume variable names of "wordList" and "score" for the variables mentioned above. Individual words in wordList will be referred to as "word".
- The wordList is created for you as part of the code provided in the english_test.py starter file.
- The "random.sample()" function can be used to randomly select a number of items from a list.

2. Enter a loop that repeats once for each word in wordList.
- Using a "for" loop and the "enumerate()" function is an effective way to loop through the words in wordList. See Lecture 3, Slide 38 for an example of this.
The body of this loop must...

Print the current word as well as the number of the word, e.g. "Word 1/5: HELLO".

Generate a random number between 1 and 4, and use it to choose which question is asked.

If the random number is 1, ask the user "How many letters does the word contain?" and prompt them for input. Assess their answer, and then print an appropriate message.
- Remember to convert the user's response to an integer so that you can assess it correctly.
- If the user answers correctly, remember to add 1 to the score variable. If they answer incorrectly, remember to show the correct answer as part of the "Incorrect!" message.

If the random number is 2, ask the user "How many vowels does the word contain?" and prompt them for input. Assess their answer, and then print an appropriate message.
- Remember to convert the user's response to an integer so that you can assess it correctly.
- Use the "countVowels" function (detailed below) to determine the correct answer.
- If the user answers correctly, remember to add 1 to the score variable. If they answer incorrectly, remember to show the correct answer as part of the "Incorrect!" message.

If the random number is 3, ask the user "How many consonants does the word contain?" and prompt them for input. Assess their answer, and then print an appropriate message.
- Remember to convert the user's response to an integer so that you can assess it correctly.
- Use the "countVowels" function here as well - all letters that are not vowels are consonants.
- If the user answers correctly, remember to add 1 to the score variable. If they answer incorrectly, remember to show the correct answer as part of the "Incorrect!" message.

If the random number is 4, randomly select a number within the length of the word, (e.g. if the word is HOUSE, a number between 1 and 5) and use it to ask the user "What is letter # of the word?", where "#" is the selected number. Prompt the user for input, assess their answer, and then print an appropriate message.
- Convert the user's response to uppercase so that you can assess it regardless of case.
- If the user answers correctly, remember to add 1 to the score variable. If they answer incorrectly, remember to show the correct answer as part of the "Incorrect!" message.

3. The last thing the program should do (after the body of the loop described in Requirement 2) is print a "Game Over" message that includes the user's score out of 5.


Attachment:- english-test.rar

Python, Programming

  • Category:- Python
  • Reference No.:- M91940539
  • Price:- $130

Guranteed 48 Hours Delivery, In Price:- $130

Have any Question?


Related Questions in Python

Part i the assignment filesone of the most important

Part I: The Assignment Files One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a ...

Homework -this homework will have both a short written and

Homework - This homework will have, both a short written and coding assignment. The problems that are supposed to be written are clearly marked. 1) (Written) Make heuristics Describe two heuristics for the slide problem ...

Tasksdemonstrate data scraping of a social network of

Tasks Demonstrate data scraping of a social network of choice. Develop technical documentation, including the development of the code & detailing the results. Provide a report on the findings, that includes research into ...

Assignment1 utilising python 3 build the following

Assignment 1. Utilising Python 3 Build the following regression models: - Decision Tree - Gradient Boosted Tree - Linear regression 2. Select a dataset (other than the example dataset given in section 3) and apply the De ...

Python programming assignment -you first need an abstract

Python Programming Assignment - You first need an abstract base class, called, Account which has the following attributes and methods: accountID: This attribute holds the ID assigned the account , if not provided set to ...

Learning outcomes lo3 - research develop and document a

Learning Outcomes LO3 - Research, develop, and document a basic security policy, and analyse, record, and resolve all security incidents LO4 - Identify and assess the threats to, and vulnerabilities of networks Assessmen ...

Question research pythons dictionary data type dictdiscuss

Question : Research Python's dictionary data type (dict). Discuss its interface and usage. Include examples. Discuss practical applications of dictionaries.

Questionwhat is a python development frameworkgive 3

Question What is a python development framework? Give 3 examples python development framework used today. and explain which development framework is used in which industry.

Below zero - ice cream storethe local ice-cream store needs

Below Zero - ice cream store The local ice-cream store needs a new ordering system to improve customer service by streamlining the ordering process. The manager of the store has found that many orders are incorrect and s ...

The second task in this assignment is to create a python

The second task in this assignment is to create a Python program called pancakes.py that will determine the final order of a stack of pancakes after a series of flips.(PYTHON 3) Problem Task In this problem, your input w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As