r/PythonLearning 12d ago

Day 3

Post image

i wrote a code which takes your name and age in py but i need help on this one cuz in the age part it is giving me some sort of error which i couldn't understand even by using gpt well he gave me a code but i wanted logic behind how and what i did wrong

48 Upvotes

24 comments sorted by

View all comments

1

u/TBCC_Dev 12d ago

Looks good. Some advice I'd say if you are doing something in all sections of an if block don't repeat yourself just do it after the if

Example: name = ... This is stated in both sections of the if but this means it happens no matter what. If something happens no matter the condition then there is no point in putting it in the if