-
-
Save Mohamed2del/a69a57dde82453a963c86af915b08feb to your computer and use it in GitHub Desktop.
score = input("Enter Score: ") | |
s = float(score) | |
x = 'Error' | |
if s >= 0.9: | |
x = 'A' | |
elif s >=0.8: | |
x='B' | |
elif s >=0.7: | |
x='C' | |
elif s >= 0.6: | |
x='D' | |
elif s < .6: | |
x ='F' | |
else: | |
x ="Out of Range" | |
print (x) | |
pratamatama
commented
Aug 4, 2021
•
it does work for me :))
score = input("Enter Score: ")
fscore = float(score)
x = fscore
if x >= 0.9:
print("A")
elif x >= 0.8:
print("B")
elif x >= 0.7:
print("C")
elif x >= 0.6:
print("D")
elif x < 0.6:
print("F")
else:
print("error")
quit()
it work:)
score = input("Enter Score: ")
gr=float(score)
if gr<1 :
if gr>=0.9:
print("A")
elif gr>= 0.8 :
print("B")
elif gr>= 0.7:
print("C")
elif gr>= 0.6 :
print("D")
elif gr< 0.6 :
if gr>0:
print("F")
else:
print("sorry error input please exite")
score = raw_input("enter a score:")
s = float(score)
if 0.0 <= s <= 1.0:
if s >= 0.9:
result = "A"
print result
elif 0.8 <= s < 0.9:
result = "B"
print result
elif 0.7 <= s < 0.8:
result = "C"
print result
elif 0.6 <= s < 0.7:
result = "D"
print result
else:
result = "F"
print result
else:
print "Error: score out of range"
score = input("Enter Score: ")
s = float(score)
try:
if s >= 0.9:
print("A")
elif s >= 0.8:
print("B")
elif s >= 0.7:
print("C")
elif s >= 0.6:
print("D")
elif s < 0.5:
print("F")
except:
print("Input a value in the range between 0.0 and 1")
score = input("Enter Score: ")
s = float(score)
if 1.0> s >= 0.9:
print('A')
elif 0.9>s >= 0.8:
print('B')
elif 0.8>s >= 0.7:
print('C')
elif 0.7>s >= 0.6:
print('D')
elif 0.0<s < 0.6:
print('F')
else:
print('x out of range')
score = input("Enter Score: ")
s=float(score)
if s>1:
print("Error")
quit()
elif s>=0.9:
print("A")
elif s>=0.8:
print("B")
elif s>=0.7:
print("C")
elif s>=0.6:
print("D")
elif s<0.6:
print("F")
score = input("Enter Score: ")
try :
s=float(score)
except:
print("error")
quit()
if s >= 0.9:
print("A")
elif s >= 0.8:
print("B")
elif s >= 0.7 :
print("C")
elif s >= 0.6:
print("D")
if s < 0.6 :
print("F")
score = input("Enter Score: ")
s = float(score)
if s<0.0 or s>1.0:
print("wrong")
exit()
if s<0.6:
print("F")
elif s<0.7:
print("D")
elif s<0.8:
print("C")
elif s<0.9:
print("B")
else:
print("A")
This one works fine
score = input("Enter Score: ")
try:
s = float(score)
if(s<=1):
if(s>=0.9):
print("A")
elif(s>=0.8):
print("B")
elif(s>=0.7):
print("C")
elif(s>=0.6):
print("D")
elif(s<0.6):
print("F")
elif(s>1):
print("Error! Score exceeds 1.0")
except:
print("Error! Not a Number")
quit()
My code is easy to understand and simple and will work in all conditions
I hope this helps.
score = input("Enter Score: ")
sc = float(score)
if sc>1.0:
print("Error")
elif sc>=0.9 and sc<1.0:
print("A")
elif sc>=0.8 and sc<0.9:
print("B")
elif sc>=0.7 and sc<0.8 :
print("C")
elif sc>=0.6 and sc<0.7:
print("D")
elif sc<0.6:
print("F")
try:
score=float(input("Enter Score: "))
except:
print("Data type Error, Enter a numeric")
quit()
if score > 1.0 or score<0.0 :
print("Number is out of Range, Enter a number between 0.0 to 1.0")
quit()
if score>=0.9:
print("A")
elif score>=0.8:
print("B")
elif score>=0.7:
print("C")
elif score>=0.6:
print("D")
else:
print("F")
score = input("Enter Score: ")
s = float(score)
if 0<=s<=1:
if s >= 0.9:
x = 'A'
elif s >=0.8:
x='B'
elif s >=0.7:
x='C'
elif s >= 0.6:
x='D'
else:
x ='F'
print(x)
else:
print("your value is out of range")
score = input("Enter Score: ")
istr = float(score)
if istr > 1.0:
print ('THE GIVEN NUMBER IS OUT OF RANGE. PLEASE ENTER ANUMBER BETWEEN 0.0 AND 0.1')
elif istr>=0.9:
print('A')
elif istr>=0.8:
print('B')
elif istr>=0.7:
print('C')
elif istr>=0.6:
print('D')
else:
print('F')
Other codes appeared too complicated so here's a simple code that I wrote as a very beginner
score = input("Enter Score: ")
S=float(score)
if S>= 0.9:
print("A")
elif S>= 0.8:
print("B")
elif S>= 0.7:
print("C")
elif S>= 0.6:
print("D")
elif S>= 0.6:
print("F")
else:
print("out of range")
score = input("Enter Score: ")
try:
s = float(score)
except:
print("Please Enter A Number between 0.0 & 1.0")
if s >= .9:
print("A")
elif s >= .8:
print("B")
elif s >= .7:
print("C")
elif s >= .6:
print("D")
else:
print("F")
s = input('Enter Score:')
score = float(s)
x = 'Error'
if score==0.9:
print('A')
elif score==0.8:
print('B')
elif score==0.7:
print('C')
elif score==0.6:
print('C')
elif score<0.6 :
print('F')
else :
print("Error")
try: score = float(input('Enter score: ')) if score < 0 or score > 1: raise ValueError except: print('Bad Score') quit() grade = 'F' if score >= 0.9: grade= 'A' elif score >= 0.8: grade = 'B' elif score >= 0.7: grade = 'C' elif score >= 0.6: grade = 'D' print(grade)
this works. great job!! thank you
this is the best one
score = input("Enter Score: ")
try:
s = float(score)
except:
print("Bad score")
quit()
if s > 1.0:
print("Bad score, Enter a valid score")
quit()
if s < 0.0:
print("Bad score, Enter a valid score")
quit()
elif s >= 0.9:
print("A")
elif s < 0.9 and s >= 0.8:
print("B")
elif s < 0.8 and s >= 0.7:
print("C")
elif s < 0.7 and s >= 0.6:
print("D")
elif s < 0.6:
print("F")
else:
print("Bad score")
score = input("Enter Score: ")
try:
s = float(score)
except:
print("Bad score")
quit()
if s > 1.0 or s < 0.0:
print("Bad score, Enter a valid score")
quit()
elif s >= 0.9:
print("A")
elif s >= 0.8 and s < 0.9:
print("B")
elif s >= 0.7 and s < 0.8:
print("C")
elif s >= 0.6 and s < 0.7:
print("D")
else:
print("F")
score = input('Enter the score:')
try:
float(score)
if float(score)>1.0 or float(score)<0:
print('Bad score')
elif float(score) >= 0.9 :
print('A')
elif float(score) >= 0.8:
print('B')
elif float(score) >= 0.7:
print('C')
elif float(score) >= 0.6:
print('D')
else :
print('F')
except:
print('Bad score')
score = input("Enter Score: ")
try:
Fscore = float(score)
except:
print("Enter Numeric Number")
quit()
if Fscore >= 1.0:
if Fscore < 0.0:
print("Enter Value Between 0.0 and 1.0")
quit()
if Fscore >= 0.9:
print("A")
elif Fscore >= 0.8:
print("B")
elif Fscore >= 0.7:
print("C")
elif Fscore >= 0.6:
print("D")
elif Fscore < 0.6:
print("F")
s=input("score")
sc=float(s)
x=("error")
if sc >1:
print(x)
exit()
elif sc >= 0.9:
x= ('A')
elif sc >= 0.8:
x = ('B')
elif sc >= 0.7:
x = ('C')
elif sc >= 0.6:
x = ('D')
elif sc < 0.6:
x = ('F')
else:
x=("error message")
print(x)
print('Enter A Score Between 0.0 and 1.0')
score=float(input())
if score>=0.9 and score<=1.0:
print('A')
elif score>=0.8 and score<0.9:
print('B')
elif score>=0.7 and score<0.8:
print('C')
elif score>=0.6 and score<0.7:
print('D')
elif score<0.6:
print('F')
else:
print('Bad Score')
score = input("Enter Score: ")
s = float(score)
if s > 1.0:
print('error')
elif s == 1.0:
print('A')
elif s >= 0.9:
print('A')
elif s >= 0.8:
print('B')
elif s >= 0.7:
print('C')
elif s >= 0.6:
print('D')
elif s< 0.6:
print('F')
xx= input("enter the grade: ")
x= float(xx)
if x > 1:
print("Number is out of Range")
print("Enter number between 0.0 to 1.0")
elif x <=0:
print("Number is out of Range")
print("Enter number between 0.0 to 1.0")
elif x >=0.9:
print("A")
elif x >= 0.8 :
print("B")
elif x >= 0.7 :
print("C")
elif x >= 0.6:
print("D")
elif x < 0.6:
print("F")
**Hope so it works ** suggestions are appreciated at [email protected]
score = input("Enter Score: ")
try:
s = float(score)
except:
print("Out of range")
quit()
if s > 1.0:
print("Out of range")
elif s >= 0.9:
print("A")
elif s >=0.8:
print("B")
elif s >=0.7:
print("C")
elif s >= 0.6:
print("D")
elif s < 0.6:
print("F")
else:
print("Out of range")
score = input("Enter Score: ")
s = float(score)
if s >= 0.9:
print('A')
elif s >= 0.8:
print ('B')
elif s >= 0.7:
print('C')
elif s >= 0.6:
print('D')
elif s< 0.6:
print('F')
else:
print(" Out of range ")
score = input("Enter Score: ")
try:
s = float(score)
except:
print("Please type a numeric value in between 0.0 - 1.0")
quit()
if s > 1.0 or s < 0:
print("Please enter a grade in range of 0.0 - 1.0")
quit()
elif s >= 0.9:
print("A")
elif s >= 0.8:
print("B")
elif s >= 0.7:
print("C")
elif s >= 0.6:
print("D")
elif s < 0.6:
print("F")
elif s > 1.0 or s < 0:
print("Please enter a grade in range of 0.0 - 1.0")
quit()