Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import tkinter.simpledialog
- import tkinter.messagebox
- root = Tk()
- w = Label(root, text="GPA")
- w.pack()
- grade1 = tkinter.simpledialog.askinteger("Grade 1", "Please enter the number for your first grade (A=4, B=3, C=2, D=1, F=0)")
- #1. add 3 more statments like the one above so your program will ask for 4 grades total.
- sum = grade1;
- #2. edit the line above to add up all the grades from #1;
- gpa = sum;
- #3. edit the line above to divide the sum by 4.0
- tkinter.messagebox.showinfo("GPA", "Your GPA is " + str(gpa))
- #Answer questions 4-6 on paper.
- #4. What's the most number of F's you can get and still get a 2.0?
- #5. What would you have to change in the code if it was supposed to work with
- # 6 grades instead of 4?
- #6. In #3, what happens if you try to divide by 4 instead of 4.0? Try it both
- # ways with the grades, 4, 3, 2, 1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement