I have never taken a programing class before but my instuctor wants me to write a program in python i've been looking in the book and still don't even know where to start please any help would be great here's the program she wants

You are helping your friend throw a keg party. Since you are a programmer you are going to write a program to help him determine how many kegs he needs to buy based on the following information. You are also going to stay sober and be the designated driver so it will be easier to check to see if your calculations were correct at the end of the night (or early next morning).
Here are some facts so that you can create a program to output how many kegs your friend needs to purchase.
1 keg is 1948 ounces
A whole drink is 12 fluid oz.
If your friends are “light” drinkers then they will drink 6 beers each on average.
If your friends are heavy drinkers then they will drink 12 beers each on average.
Here’s the pseudo-code for the program:
Prompt your friend for how many drinkers will be present.
Prompt your friend to enter 1 if this crowd are light drinkers or enter 2 if heavy drinkers.
Based on the information you now know, output how many kegs your friend should purchase.


P.S i need this done by 3-12-12

Recommended Answers

All 4 Replies

thanks Gribouillis but i have never even writtin a code before i'm reading the book as fast as i can but i still can't find anything in there to even start the code if i can find at least a starting point then i could probly figure it out

All you need to do is to expand the pseudo-code your teacher gave you. Here is a hint to get you started:

# Prompt your friend for how many drinkers will be present.
prompt = 'How many drinkers will be present? '
drinkers = int(input(prompt))

# Prompt your friend to enter 1 if this crowd are light drinkers or enter 2 if heavy drinkers
prompt = 'Enter 1 if they are light drinkers or enter 2 if heavy drinkers: '
drinker_type = int(input(prompt))

# If your friends are light drinkers then they will drink 6 beers each on average.
if drinker_type == 1:
    drinks = drinkers * 6
# If your friends are heavy drinkers then they will drink 12 beers each on average.
else:
    drinks = drinkers * 12

print("You need enough beer for %d drinks" % drinks)  # test

# Now do the math with the rest of the information
# A whole drink is 12 fluid oz.
# 1 keg is 1948 ounces
# Output how many kegs your friend should purchase.

thank you very much hihe that will get me started im gonna work on it now

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.