写作COMP101实验编程、 辅导Programming课程、 写作Python课程程

” 写作COMP101实验编程、 辅导Programming课程、 写作Python课程程序COMP101 2020-21 Assignment-05: Page 1COMP101Introduction to Programming 2020-21Assignment-05Issue Date: Monday 23rd November 2020Submission Date: Monday 30th November 2020 17:001. Overviewa) Summary:This assignment is worth 16% of the total marks for COMP101.You must submit an attempt at this assignment else a fail grade for the modulewill be awarded. Plagiarism and collusion guidelines apply throughout.b) Guidance:Assessment is based on solving the problem specification in terms of design,clarity, accuracy and appropriate use of code and documentation.See below for Zssignment advice: No test table is neededc) Submission (one file to be submitted):a) Submit one .py file with filename in format of:familyName_givenName-CA05.py e.g. Smith_John-CA05.pyWithin the Code, the first lines should be comment lines as follows:#familyName_givenName University id filename Month and Year of coding, filename.py#Brief description of the problem solved#Smith_John 20141234 November 2021 CA-05.py#Description here (keep it clear but brief)c) Submit your document electronically via the department submission server: httpss://sam.csc.liv.ac.uk/COMP/Submissions.plEarlier submission is possible, but any submission after the deadline attracts thestandard lateness penalties, see: https://www.csc.liv.ac.uk/department/regulations/practical.htmlCOMP101 2020-21 Assignment-05: Page 22. Assessment InformationAssignment Number 05 (of 07)Weighting 16%Assignment Circulated See front pageDeadline See front pageSubmission Mode e-submissionLearning outcome assessed 1, 4, 5, 6, 7Purpose of assessment Fully modularise and parameterise usingsequence, selection and iterationconstructs to control I/O of strings andnumbers in successful calculations for agiven problem.Marking criteria Total marks over seven questions as apercentageSubmission Necessary in order Yesto satisfy module requirements? Assignments are not markedanonymouslyLate Submission Penalty Standard UoL Policy.COMP101 2020-21 Assignment-05: Page 33. Problem Specification:Implement and execute a program that predicts user input inthe form of a game. Using guided prompts, the programshould perform input and calculation of integers and stringsand output a prediction.Algorithm not to be amended:Step-1: Input single integer 1-9Step-2: Multiply by 9Step-3: Add the result togetherStep-4: Subtract 5Step-5: Input a country beginning with the 4th letter of theEnglish alphabetStep-6: Input a mammal beginning with the 2nd letter of thecountryStep-7: Prompt to see the answer (y/n): If y, show theprediction together with analysisCOMP101 2020-21 Assignment-05: Page 4For illustration only o/p of your own design :Step-1:Enter an integer, 1 to 9 inclusive: 5Your first number is: 5Step2:What does 3 x 3 = 9Your second Number is: 45Step-3:Your second number is being added togetherYour third number is 9Step-4:What does 8 – 3 = 5Your fourth number is 5Step-5:[a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]If a = 1 and z = 26, what is d = 4Confirming the fourth letter of alphabet is: dEnter the name of a country beginning with this letter: denmarkCOMP101 2020-21 Assignment-05: Page 5Step-6:Your country is: denmarkThink of a mammal beginning with second letter of selected country: elephantStep-7:Want to see the answer? (Y/N): yBased on the numbers: 5 45 9 5We predict your country is Denmark and your animal is ElephantYou played the game using: 5, 45, 9, 5, denmark, elephantCOMP101 2020-21 Assignment-05: Page 6Input and validation:Validation is needed for each of the integer inputs infunction-1, function-2 and function-4, as the game is relianton correct integers being input.If invalid Data is input, this should be disallowed. Inform theuser and ask them to re-input the value until it is correct.No validation is needed on the input string for country andmammal in function-5 and function-6.There is no requirement for a menu.In main(), start the program with a simple Play the game?type of prompt. If user replies yes, run the game, else end theprogram gracefully (dont just let it stop abruptly).Allow the user to play as many times as they like.COMP101 2020-21 Assignment-05: Page 7Process:The program should be fully modularised using functions,arguments and parameters.In main(), make a sequence of calls to each function, passingarguments as needed in the order you expect the functions toexecute.Each function should achieve one task and do it well.There should be a minimum of seven separate functions withno functions Nested in others. Calls are via function main().Function-1:Prompt for input 1 to 9 inclusiveAccept an integer validate the inputPass the result to function-2Function-2:Accept the result from function-1Prompt the user with an equation or other prompt thatproduces result = 9e.g.what is 3 x 3 = ?Validate the input it must be 9Multiply the result from function-1 by 9Pass the result to function-3COMP101 2020-21 Assignment-05: Page 8Function-3:Accept the result from function-2Add the result together no user input is needed here, henceno validation:e.g.if the result from function-2 = 34then result for function-3 = 3 + 4 = 7Inform the user what the result isPass the result to function-4NOTES for function-3:To indicate appropriate testing and analysis and to aidmaintenance, use commentary in this function to explain howyou solved any code problems you encountered for thisfunction to operate correctly.Keep the explanation clear and simple: Identify theproblem(s) And briefly describe your solutionFunction-4:Accept the result from function-3Prompt the user with an equation or other prompt thatproduces result = 5e.g.what is 8 3 = ?Validate the input it must be 5Pass the result to function-5Function-5:Accept the result from function-4COMP101 2020-21 Assignment-05: Page 9Output a list of the English alphabet – all 26 characters (lowercase is okay) to give your user a reference pointe.g.alphabet_list = [a, b, c, . . . , x, y, z]Prompt the user with an equation or other prompt thatproduces result = 4e.g.what is 2 + 2 = ?Validate the input it must be 4Using the list index, confirm to the user what the fourth letterof the alphabet is (it is d)Prompt the user to enter a country beginning with this letter(case does not matter and do not validate)Pass the country to function-6Function-6:Accept the Country from function-5Prompt the user to input a mammal beginning with the secondletter of the country (case does not matter and do not validate)Function-7:In main(), when all input/processing is done, ask the user ifthey want to see the answer.If reply is yes, call a final function to show the prediction.If reply is no, exit the program gracefully dont just let itstop without informing the user what is happening.We could argue that function-5 is multi-tasking. It accepts integer input, looks up anitem in a list, outputs the item and then prompts for string input.But the code logically belongs together: integer 4 is linked to the list we have to havethe integer to extract letter d it is always d that we want. Being able to echo back tothe user the number 4 and letter d helps us steer the user to input what we want them toinput – denmark Without distracting them.COMP101 2020-21 Assignment-05: Page 10Output (minimum):Show your user something like the following (design is atyour discretion):This computer can read your mind!Based on the numbers you used:Your country was DenmarkYour Mammal was ElephantYou used these numbers:(Show the numbers that were used to predict the answer, i.e.the results from function-1, 2, 3 and 4)Your full inputs were:(Echo all the numbers and also the strings used in theprogram)It doesnt matter if your user has input a different country/mammal.The game works on the probability that Denmark and Elephant are the mostlikely outcomes. There will be a minority of users that think of somethingdifferent. There is no requirement to address this scenario如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导