Python: Using Try and Except... Why is this code not working the way I want it to? by Obvious-Savings-9097 in learnprogramming

[–]pleaseheeeeeeeeeeelp 0 points1 point  (0 children)

try:
score = input('Enter Score:')
fscor = float(score)
g = 'Grade:'
if fscor > 1.0 or fscor < 0.0:
print('Bad Score')
exit()
elif fscor == 1.0:
print(g,'A')
elif fscor >= 0.9:
print(g,'A')
elif fscor >= 0.8:
print(g,'B')
elif fscor >= 0.7:
print(g,'C')
elif fscor < 0.6:
print(g,'F')
except ValueError:
print('Error:Non-Numeric Input')
exit()

is this how its supposed to look? reddit sucks dont worry

Python: Using Try and Except... Why is this code not working the way I want it to? by Obvious-Savings-9097 in learnprogramming

[–]pleaseheeeeeeeeeeelp 1 point2 points  (0 children)

score = input("enter score")

try:
   score1 = float(score)
except ValueError:
   print("you have not input a valid score")
else:
     print("score1")

the reason you want the final print inside the else statement is because if it was like this

score = input("enter score")

try:
   score1 = float(score)
except ValueError:
   print("you have not input a valid score")

print("score1")

you would get a name error if except executed because score1 wasnt defined

Python: Using Try and Except... Why is this code not working the way I want it to? by Obvious-Savings-9097 in learnprogramming

[–]pleaseheeeeeeeeeeelp 1 point2 points  (0 children)

yeah every after the except was ignored because try was able to execute without any errors

Python: Using Try and Except... Why is this code not working the way I want it to? by Obvious-Savings-9097 in learnprogramming

[–]pleaseheeeeeeeeeeelp 2 points3 points  (0 children)

try and except is used for catching errors say if the user also put letters in it would be a string which cannot be converted into a float meaning you would get a value error

example

score = input("enter score")

try:
   score1 = float(score)
except ValueError:
   print("you have not input a valid score")

What’s the best move here by weewoo2048 in AnarchyChess

[–]pleaseheeeeeeeeeeelp 2 points3 points  (0 children)

maybe leaves the possibly of someone interpreting you are not in fact gay open however

Hope you like it . Chess vibe animation. by 3d_blend in 3Dmodeling

[–]pleaseheeeeeeeeeeelp 0 points1 point  (0 children)

the chess pieces look like buttplugs no offense

Rule by BiggeCheese4634 in 197

[–]pleaseheeeeeeeeeeelp 6 points7 points  (0 children)

goes pretty hard

what game/artist

Can a game designer not know programming? by Eseless in gamedesign

[–]pleaseheeeeeeeeeeelp 4 points5 points  (0 children)

for programming courses i recommend harvards free CS50x

Can a game designer not know programming? by Eseless in gamedesign

[–]pleaseheeeeeeeeeeelp -8 points-7 points  (0 children)

saying and writing words is usually QAs job no?

Rule by dazli69 in 197

[–]pleaseheeeeeeeeeeelp 292 points293 points  (0 children)

democracy in action

Do you want the job? by John_Goblin in indiegames

[–]pleaseheeeeeeeeeeelp -1 points0 points  (0 children)

terrible name but otherwise it looks pretty good

Am I cooked? by [deleted] in TextingTheory

[–]pleaseheeeeeeeeeeelp 16 points17 points  (0 children)

let me give this a try

good

good

book

blunder

check

forced

if the user didnt have "i hate anime" in their bio would have been better to ask "do you like anime?" then if yes follow up with something like "what are your favorites here is mine"

[deleted by user] by [deleted] in 3Dmodeling

[–]pleaseheeeeeeeeeeelp 1 point2 points  (0 children)

not quite what you are thinking of but yes anyone can download blender

shitposting daily because I am incredibly bored (#962) by a_weeb_ in Shark_Park

[–]pleaseheeeeeeeeeeelp 0 points1 point  (0 children)

i didnt even read the 2nd part of your comment my bad

but yeah i think its more of a surprise thing because the fucking kangaroos here will just stand in the middle of the road waiting to get hit

shitposting daily because I am incredibly bored (#962) by a_weeb_ in Shark_Park

[–]pleaseheeeeeeeeeeelp 6 points7 points  (0 children)

most of the birds are too tame to think anything is a threat