Create a Python project in IDLE and begin the Project Program by developing a Python Function
Knowing how to write, compile and execute code is a skill you’ll need throughout your professional career. In this course, you’ve learned how to create software programs using standard coding structures and processes such as variables, constants, operators, decision logic, arrays, iteration constructs, and functions. For this assignment, you will write an application using the Python programming language. Write a program that uses the random module to play Guess the Number game. The program should consist of three functions. The first will display the Title and program specifications. The second plays the game. The main function calls those functions as it controls the playing of the game. The Python program should be developed in three steps and each step builds off the code from the previous step, which is listed below. Note: be sure to leave comments in your code that explain the intention of your functions.
Prompt
1. Create a Python project in IDLE and begin the Project Program by developing a Python Function called display title() to display the title and programming specifications for the project.
2. Expand the Project Program and create a function called play game() that uses the randint() function that gets the number that the player has to guess. It then returns a random number between 1 and 10. Use a while statement so the user can guess the number until the guess is correct. If the users guess is lower than the random number then display the message ‘Too low’. If the user guess is higher than the random number then display the message ‘Too high’. If the user guess matches the random number display the message, ‘You guessed it ‘. Then, a return statement returns to the statement in the main() function that is after the call to the play game() function.
3. Expand the Project Program and create main() function to the function call statements. Call the display title() function. Then define a variable that will hold the value of yes. Create a loop that will check the variable, while the variable equals yes then call the play game function. Then allow the user to input if they want to play again. If yes, play again, if no end the program.
Related Lessons
You can use the following lessons in the course in order to help you work through this assignment:
· Coding Input & Output & Writing Comments in Python
· Defining & Calling a Function in Python
· While Loops in Python: Definition & Examples
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.