SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 2 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 11 Dec 2017 My Price 10.00

create working Python Code for this assignment

Can someone help me create working Python Code for this assignment? Don't worry about the flowchart I only need the actual Python code.

User Defined Functions – The Gold Game You are creating a game to see how greedy the user is. They will be told that there is a room full of gold and that they can take out a percentage of the gold. If they take out more than 50% they are greedy and go to the dungeon. If they take out 50% or less they are not greedy and win the game. You will use two (2) user defined functions (modules): • The welcome or starting function (module) includes o The title of the program o Asking for the user’s name ▪ Within this function (module) I set the name variable to global then used the variable to get the user’s name ▪ You may use this method or whatever method you like to make the name variable passable • The body function (module) which asks for the percentage of the gold the user would take out of the room o Percentage is implied – you do not have to determine the formatting code for percentage (see example) o Use ValueError to check if they entered a number The program in the example uses “If-then-Else” inside of the second user defined function (module) Exiting the program • To exit the program I used the sys.exit(0) function o I placed this command after the “true” portion of the “If-then-Else” statement o The message that the user was not greedy and won the game runs o The exit command runs next and the program is exited o See example • Just like when you used the “random” function, you had to import the function, you will need to import the “sys” function. • Type the following in at the beginning of your coding: ▪ import sys o The command to exit within the function (module) is: ▪ sys.exit(0) Hints: • Check for greediness (using amount as the variable in this example) o amount <= 50 o Do not worry about a percent format • Import the sys function (see above for command) • Use ValueError to check for numeric errors Turn projects into Moodle: • Flowchart • Screenshot of working python file • Python file

Attachments:

Answers

(5)
Status NEW Posted 11 Dec 2017 07:12 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)