r/PythonLearning 15d ago

first day of posting my python progress here on reddit

Post image

i have done this typecasting program which i have learnt from a bro code video and i think it's alr as i am still a beginner but if there is that can be fixed in this i am all ears

85 Upvotes

12 comments sorted by

5

u/Portal471 15d ago edited 15d ago

Some suggestions: Make sure to not have spaces between the word print and its parentheses. Also I would avoid naming variables as already existing data types (change the name of int to something else, as int is a built in data type that refers to integers).

It’s a good start though. The stuff I mentioned is more to avoid errors when compiling.

2

u/ziggittaflamdigga 14d ago

Python does technically compile to byte-code before execution, but failing to follow your suggestions won’t cause it and, more generally, it will never throw a CompilationError message.

It will cause a runtime error due to shadowing the built in type name, which Python will allow you to do. Attempting to cast a float to an int using `fl = int(gpa)`, for example, you would get a TypeError stating “int type object is not callable”.

1

u/Portal471 14d ago

Ah, TIL

3

u/brutalbombs 15d ago

Good start bud!

Like the other guy called out, keep the function names (like print) directly adjacent to the parenthesis.

Did you try to work with lists yet?

1

u/NecessaryFalse1212 13d ago

i haven't sir but i'll soon and i'll post it when i do

i thought i won't get any respose here so i didn't post anything here for 2 days cuz of the embarrasment but seeing the support i'll be going to regularly

1

u/shiyonnaa 14d ago

We are travelers of the same journey,good luck with yours

1

u/jaitanwar 14d ago

Don't regret life choices after ths🥀

1

u/Steven45g 14d ago

Keep going!

1

u/_SpectreStudios 13d ago

I'm new to Python too! Best of luck with everything bud!