We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d2798f2 commit 7ca122aCopy full SHA for 7ca122a
1 file changed
Week5_Assignment_3_3.py
@@ -0,0 +1,32 @@
1
+'''Write a program to prompt for a score between 0.0 & 1.0.
2
+If the score is out of range, print an error.
3
+If the score is between 0.0 & 1.0, print the grade using the following table:
4
+>= 0.9 Grade A
5
+>= 0.8 Grade B
6
+>= 0.7 Grade C
7
+>= 0.6 Grade D
8
+< 0.6 Garade F'''
9
+
10
+#take input
11
+sc = input('Enter score: ')
12
13
+#check for valid input
14
+try:
15
+ vsc = float(sc)
16
+except:
17
+ print('Score must be a neumeric value between 0.0 & 1.0')
18
+ quit()
19
20
+#if input is valid, evaluate the grade
21
+if(vsc>0.0 and vsc<0.6):
22
+ print('F')
23
+elif(vsc>=0.6 and vsc<0.7):
24
+ print('D')
25
+elif(vsc>=0.7 and vsc<0.8):
26
+ print('C')
27
+elif(vsc>=0.8 and vsc<0.9):
28
+ print('B')
29
+elif(vsc>=0.9 and vsc<=1.0):
30
+ print('A')
31
+else:
32
+ print('Score must be between 0.0 & 1.0')
0 commit comments