Can someone please convert this pseudocode to python!!! ITS AN EMERGENCY.?

Home » Programming & Design » Can someone please convert this pseudocode to python!!! ITS AN EMERGENCY.?
Programming & Design No Comments

hi, i need to write program on python for an assignment, my teacher wrote this pseudocode for the question and said if i can convert it into python the question would be complete:

BEGIN
open receipt for Output
Get price,code
Set total to 0
WHILE code NOT EQUAL Z
discount=convertCode(code)

hi, i need to write program on python for an assignment, my teacher wrote this pseudocode for the question and said if i can convert it into python the question would be complete:

BEGIN
open receipt for Output
Get price,code
Set total to 0
WHILE code NOT EQUAL Z
discount=convertCode(code)
discount price=price-(price*discount)
write receipt(price,discount,discount price)
total=total+discount price
Get price,code
ENDWHILE
while receipt(total)
close receipt
END
BEGIN convertCode(code)
CASEWHERE code is:
choice A: return 0.5
choice B: return 0.4
choice C: return 0.2
choice D: return 0
ENDCASE
END

Other answer:

EddieJ:
To convert
Get price,code

to Python, you have to know if it's Python2 of Python3.

You would also have to decide if you are going to ask for each of those values separately, or if you are going to expect the values on one line with a space separating them.

In any case, if you make a sincere attempt and show us what you tried then we can help you.

Note: In Python, it is important to show indentation (which Y!A removes) so either use "… " for each indentation level (with a blank space between each level), or use #end comments to delimit blocks, or use a code-posting site (ideone.com, codepad.org) and post the link here.

Oh, and we know it's NOT an emergency. An emergency is when someone might die if something isn't done.

——————–
Note:

while receipt(total)
close receipt
END

This pseudocode looks wrong. Pseudocode doesn't really have any rules — except to be consistent within a project. (Although your teacher might have rules.)

You spelled WHILE with all CAPS earlier and you ended it with ENDWHILE instead of END.

And the close should probably NOT be in a WHILE loop.

no1home2day:
If you're looking for someone to do your homework for you, you may as well just take a failing grade since you won't be learning anything.

If you want to hire a programmer, expect to pay between $75.00 and $100.00 per hour or fraction thereof if you want it done right, by a professional.

Otherwise, you get started with the project, and as you have specific questions then ask for assistance with a specific problem. Remember to show all your work.

If you can't even get started, it's time to drop the class and take up basket weaving.

Cobra:
No, the reason being, if you do not do it yourself you will never be a good programmer, part of being a programmer is looking at a set of problems splitting them up into various different parts and writing this psuedo-code which is nothing than a set of English words that describe the actions needed to complete the problem(s). For example for every particle in the cloud do nbody calculations for it. this is descriptive, but not a valid programming language, so you would code it

for (int i=0;i<cloud.count;i++){
cloud.particle[i].position += forces(cloud,i);
}

using what ever language you are learning at the time. It's meant to give you the skills to build algorithmns that are suited to the problem(s) needing to be solved, see https://en.wikipedia.org/wiki/Algorithm

DR + Mrs Bears face:
Hi No that was the idea that you should be able to do it.
beaurogard:
No

LEAVE A COMMENT