In Python The following code is intentionally done in poor style but runs as intended. def main(): c =...

60.1K

Verified Solution

Question

Programming

In Python

The following code is intentionally done in poor style but runsas intended.
def main():

c = 10

print(\"Welcome to Roderick's Chikkin and Gravy\")

e = False

while not e:

x = input(\"Would you like some chikkin?\")

if x == \"Y\" or x == \"y\":

c = f(c)

else:

e = True

if c == 0:

e = True

print(\"I hope you enjoyed your chikkin!\")

def f(c):

if c > 0:

print(\"Got you some chikkin! Enjoy\")

return c-1

else:

print(\"No chikkin left. Sorry\")

return 0

main()

1.Fix it *then* add the functions mentioned (Including totallydeleting these comments at the top and replacing them with)
What should be here as well as changing the repl name!?

2.Fix the style of this program so it is clear what it isdoing.

3.Add to the code so that, if you want chikkin, you are asked ifyou want gravy. If you say yes, the (only) output for that ordershould be, \"You get some chikkin and gravy then!\" If not, it shouldgive the same output as the original program. In both cases, itwill then ask you again if you want any chikkin.

4.Add to the code so that, if you want chikkin, you are asked ifyou want gravy. If you say yes, the (only) output for that ordershould be, \"You get some chikkin and gravy then!\" If not, it shouldgive the same output as the original program. In both cases, itwill then ask you again if you want any chikkin. (You can dowhatever you would like to get this to happen - adding a newfunction is not required but don't delete the old functionentirely). Assume you have infinite gravy so no tracking how muchgravy there is.

5.Write a simple function named startingChikkin() that has noparameters and just asks the user for how much chikkin we startwith. If the user types a positive integer, then return that value.If not, prompt again repeatedly until they enter a positive integerwhich you then return (see earlier sections on input validation) -the loop should be inside of your function. Call startingChikkin()at the start of the main() program and store the value returnedinto whatever you called your variable for tracking the number ofchikkins left.

Answer & Explanation Solved by verified expert
4.4 Ratings (732 Votes)
Here is the codedef main def startingChikkin whileTrue ans intinputHow much chikkin we start with ifans 0 returnans    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students