Member Avatar

Okay so my code is almost complete but I still need one small thing that I can figure out. When running my code it will add 5 when accelerating and subtract 5 when braking, but I need it to display an error when speed >0 when braking, then reset speed back to 0. I know this needs to be done in my def for brake but I can't figure out the proper line of code. Here is my code, thanks for any help. [(http://stackoverflow.com/questions/37124167/need-fixes-for-a-few-errors-python?noredirect=1#comment61836425_37124167)]

+0 forum 0
Member Avatar

Okay so my code works, but I need a few more requirements for it and I can't seem to get them right even though they should be pretty simple. I just need the window to display an error message when the values entered are not numerical and when the values entered are less than 0. For example when # of gallons used is -12 I need it to display an error message below the buttons, and same when letters are entered instead of numbers. I also need the calculated mpg to display to 2 decimal places and keep getting errors …

Member Avatar
+0 forum 1
Member Avatar

Hi, I'm working on this problem in my python programming class and need help with part of it. I need to have it display a "F" for anyones grade that is below 60, and also have it display the amount of "F" students, as well as the percentage of students who passed. My code correctly displays the points earned by each student but i can't figure out the rest. The students and their corresponding grades are: Johnson Smith: 93 Maryanne James: 80 Stanton Chase: 45 Mildred Morris: 90 George Deitz: 89 Maisie Kling: 79 My code is as follows: def …

Member Avatar
+1 forum 11
Member Avatar

I need help with just one line. I need an "F" to be displayed on the same line the student with 45 points. I keep getting the "F" to display on a new line below the 45. I guess something is wrong with my if statement. I also need to display the % symbol after the 83.3. I'm using python 3.5.1. Thank you so much for any help. def main(): file_students = open("student_points.txt" , "r") stu_name = file_students.readline() num_stu = 0 f_students = 1 pass_students = 5/6 print("Student\t\t\tPoints\t\tGrade") print("-------------------------------------\n") while stu_name != "": stu_name = stu_name.rstrip("\n") stu_points = file_students.readline() stu_points …

Member Avatar
+0 forum 3
Member Avatar

I am a beginner in computer programming and need help with this problem: Create a script that prompts the user to provide the number of pennies, nickels, dimes, and quarters. Display back the value of the coins in dollars and cents. Here is my code so far, everything is good except it doesn't properly display the number of cents left over. For example; if the total is $1.76 it will say "you have 1 dollar and 1 cent(s). Thanks so much for any tips/help. def main(): pennies = int(input("Enter pennies:")) nickels = int(input("Enter nickels:")) dimes = int(input("Enter dimes:")) quarters = …

Member Avatar
+0 forum 3
Member Avatar

Can someone please help me solve this problem? I've tried 20 different things and have had no such luck. The problem is: The Fast Freight Shipping Company charges the following rates: 2 pounds or less --- $1.50 per pound Over 2 pounds but not more than 6 pounds---$3.00 per pound Over 6 pounds but not more than 10 pounds---$4.00 per pound Over 10 pounds---$4.75 per pound Write a program that asks the user to enter the weight of a package and then displays the shipping charges formatted to 2 decimal places after the decimal point. Any help would be much …

Member Avatar
+0 forum 2

The End.