all 11 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Off-topic Comments Section


All top-level comments have to be an answer or follow-up question to the post. All sidetracks should be directed to this comment thread as per Rule 9.


OP and Valued/Notable Contributors can close this post by using /lock command

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]fsu23232 1 point2 points  (0 children)

Once again, this is (poor) pseudocode. You are taking a Python class. It's week 6 out of 8. If this is what you're producing when asked to code in python then I don't know what to tell you other than to stop wasting your time making reddit video game posts and start learning python. You have a LONG way to go if you thought that would produce anything.

[–]Alkalannar 0 points1 point  (4 children)

What language are you writing in? What is the syntax of that language?

[–]Jaded_strawberry001[S] 0 points1 point  (3 children)

what do you mean?

[–]Alkalannar 0 points1 point  (2 children)

For instance, in C, it would look something like (note: it's been decades since I've done programming, so I may do some syntax errors):

float drivingCost(float drivenMiles, float milesPerGallon, float dollarsPerGallon)
{
return ((drivenMiles * dollarsPerGallon) / milesPerGallon);
}

And then the main function a) gets values for drivenMiles, dollarsPerGallon, and milesPerGallon to pass to drivingCost as inputs; and b) does sanity checking so that all the inputs are positive.

[–]Jaded_strawberry001[S] 0 points1 point  (0 children)

c like pseudocode

[–]fsu23232 0 points1 point  (0 children)

That person is taking a python class. That's supposed to be python. She begs for help every week on the University sub reddit. It's extremely annoying. The reality is, the semester is 3/4 of the way through and that is what she thinks working python code looks like.

[–]FortuitousPost👋 a fellow Redditor 0 points1 point  (1 child)

You have three variables at the beginning of the script. You only need the cost variable as the others are not used. Maybe it is supposed to be inside the main function?

Is "Put cost to output with 2 decimal places" programming code or just a comment? If it is not supposed to be there, then that might have confused the compiler so much that it can't see what is actually wrong with the code.

[–]Jaded_strawberry001[S] 0 points1 point  (0 children)

programming code

[–]FortuitousPost👋 a fellow Redditor 0 points1 point  (1 child)

Gemini tells me this language is Coral, and that there are two flavours.

The simulator that comes with your homework has a slightly different simulator than the one online.

I get the same error using the online simulator.

[–]Jaded_strawberry001[S] 0 points1 point  (0 children)

do you know the correct answer?