r/PythonLearning • • Sep 19 '25

Day 4

96 Upvotes

26 comments sorted by

2

u/TfGuy44 Sep 19 '25

Oh, but I wanted to enter 0 grades... uh oh!

1

u/fatimalizade Sep 19 '25

According to my academic career😔

2

u/Loud-Bake-2740 Sep 19 '25

nice job! as others have said there’s some error handling to be had but overall this works. A good extension challenge for this would be to see how you’d track / input grades for multiple students :) happy hunting!

1

u/fatimalizade Sep 19 '25

Thank you!

2

u/Agreeable_Wish4876 Sep 21 '25

Great I think you should focus more on list comprehension

2

u/Top-Run-21 Sep 22 '25

got to learn from this, btw why did you defined a funcion for all this? for practice?

2

u/P1nkUnicorn7 Sep 23 '25

Looks good! I would also recommend using a formatting specification in the print of the average, to show 2-3 decimal points accuracy instead of 17.
print(f"Average grade: {average_grades:.2f}") I suppose that is up to personal preference, I just think it's nicer.

1

u/fatimalizade Sep 23 '25

Thank you!!

1

u/exclaim_bot Sep 23 '25

Thank you!!

You're welcome!

1

u/ConnectionWorking207 Sep 19 '25

What book are you using to learn?

1

u/fatimalizade Sep 19 '25

I don’t use any book

1

u/ConnectionWorking207 Sep 19 '25

What do you use then

1

u/fatimalizade Sep 19 '25

I ask chatgpt to teach me commands, then give me problems to solve

1

u/code_it_rightt Sep 20 '25

How many hours do you spend in a day

2

u/RailRuler Sep 19 '25

grds = [get_int("...") for i in range(number_grades)]

2

u/ConsiderationLow762 Sep 20 '25

Great practice. Also there is a better way that you can get number of grades dynamically rather than asking manually, using the built in length.

1

u/Inevitable-Age-06 Sep 20 '25

I also want to start python can we do it together? I know some basics till conditional statement.

3

u/[deleted] Sep 19 '25

[removed] — view removed comment

3

u/[deleted] Sep 19 '25

[removed] — view removed comment

2

u/fatimalizade Sep 19 '25

Thanks for the info!

1

u/FoolsSeldom Sep 19 '25

I think "always" is a bit strong. Input validation is important, but try / accept is not the only option.

For example, the str.isdecimal method is good for checking for a valid integer string.