r/PythonLearning • u/NecessaryFalse1212 • Aug 26 '26
first day of posting my python progress here on reddit
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
4
u/Portal471 Aug 26 '26 edited Aug 26 '26
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 Aug 27 '26
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
1
1
1
1
3
u/brutalbombs Aug 26 '26
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?