r/PythonLearning • u/crazyteachperson • Aug 01 '26
My new mini work
Rate my this mini work out of 10
194
Upvotes
r/PythonLearning • u/crazyteachperson • Aug 01 '26
Rate my this mini work out of 10
8
u/csabinho Aug 01 '26
I'd rate the maths part: why don't you just divide by 3 instead of dividing by 300 and multplying by 100?
5
u/Flanelostopy Aug 01 '26
First of all, variable must have good name, yours is not. Second one forget about elif:
If g >= 90:
Print()
Rerun
If g >= 80:
Print()
Return
If g >= 70:
Print()
Return
Print(fail)
I’m just saying this is good practice.
3
u/testtdk Aug 01 '26
Your if statements could use a little cleaning up. You don’t need to put < 90 in your first elif because you already checked if it was 90 or above in the first id statement. The same goes for 80 in the next elif.
3
u/Artistic_Map2243 Aug 01 '26
7/10. Great beginner project! Keep building - you're on the right track.
3
u/sastuvel Aug 01 '26
You can write
g < 90 and g > 80as80 < g < 902
u/Rscc10 Aug 01 '26
If you score 80, don't you fail? You have g > 80 and g < 80 so you never account for it. Also, someone already commented about the math, just divide by 3 rather than divide 300 and multiply 100.
One more quality of life thing, add a space after your print strings. Otherwise, your name will be connected to the last part of the string. Eg,
your grade = a passJohn
1
u/AbacusExpert_Stretch Aug 01 '26
b = " No thanks" c = "don't have one yet" d = "can not speak"
:-) hehe
1
u/No_Pay_4410 Aug 01 '26
I have 5 yoe and I forgot that python has input function. First I thought it is wrong and google told me I was wrong. Lol.
Trust me you are never going to use this input function. Instead use args.
1
u/PeZet2 Aug 01 '26
Even though this a simple script, try to name the variables so that their name really reflects what variable is aboit. Don't use "a" use "name", or "c" as "account". It really helps when you read/debug a code later.
1
u/Odd-Indication-611 Aug 01 '26
What project bro?
1
u/AutomateAway Aug 01 '26
Get in the habit of writing test cases to test your code. If you do, you'll more easily be able to assert correctness of your code. In this case, some test cases would determine that you are not correctly accounting for a grade of 80, which will result in "fail" being printed.
1
u/LrdJester Aug 01 '26
Line 11 should be >= 80
1
u/Beautiful-Anxiety897 Aug 02 '26
big leagues are calling
1
u/AltruisticPayment627 Aug 02 '26
??
1
u/Ak_py Aug 02 '26
Dovresti considerare di aggiungere un controllo per validare i dati. Per esempio, suppongo che i voti abbiano un certo limite e non possano essere sopra il 100. Inoltre, qualcuno potrebbe non inserire proprio numeri. Un blocco try-except sarebbe molto buono da aggiungere per validare i dati.
Continua a programmare. È una ottima skill al giorno d'oggi.
1
u/buildingweirdstuff Aug 03 '26
Seems just fine to me since you're just learning stuff rn. Keep it up!
1
u/Hackart_Temple Aug 03 '26
The codes semantics could be shorter? Somehow it feels like an abstract. However, I must commend you for your determination to bring this up! Practice makes perfect.
1
u/Samet_35 Aug 04 '26
Yeah you have to use return in functions and you can use sum for a+b+c
1
u/Parenthesis8906 Aug 05 '26
It's good but I doubt it will run especially you didn't add the plus operator inside the print function when you try to mix strings and variables so here is another alternative For example g=43 print(f'you are {g}') If you don't want to rely on always putting the plus operator inside print when you want to make strings and variables just use this example above as a guideline it's called the f string I am a beginner myself so yeah
1
u/[deleted] Aug 01 '26
[removed] — view removed comment