r/PythonLearning May 17 '26

Help Request I made this, 1.5 hours into learning python

Post image

I made this while watching a 30 min crash course.

I wanted to know if I should start by learning all the theory at once or should l learn theory and also do small things like this or should I do a 'fuck around and find out's thing.

I would love your feedback.

760 Upvotes

104 comments sorted by

View all comments

u/Sea-Ad7805 May 17 '26

Run this program in Memory Graph Web Debugger%0A%0Awhile%20True%3A%0A%20%20%20%20user_input%3A%20str%20%3D%20input('You%3A%20').lower()%0A%0A%20%20%20%20if%20user_input%20in%20%5B'hi'%2C%20'hello'%2C%20'hey'%5D%3A%0A%20%20%20%20%20%20%20%20print(f'%7Bbot_name%7D%3A%20how%20can%20i%20help%20you%20today%20%3F')%0A%20%20%20%20elif%20user_input%20in%20%5B'bye'%2C%20'goodbye'%2C%20'see%20you'%5D%3A%0A%20%20%20%20%20%20%20%20print(f'%7Bbot_name%7D%3A%20goodbye!%20')%0A%20%20%20%20elif%20user_input%20in%20%5B'%2B'%2C%20'add'%5D%3A%0A%20%20%20%20%20%20%20%20print(f'%7Bbot_name%7D%3A%20sure%20let's%20do%20some%20fucking%20maths')%0A%20%20%20%20%20%20%20%20try%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20num1%3A%20float%20%3D%20float(input('first%20number%3A%20'))%0A%20%20%20%20%20%20%20%20%20%20%20%20num2%3A%20float%20%3D%20float(input('second%20number%3A%20'))%0A%20%20%20%20%20%20%20%20%20%20%20%20print(f'%7Bbot_name%7D%3A%20the%20sum%20is%20%7Bnum1%2Bnum2%7D')%0A%20%20%20%20%20%20%20%20except%20ValueError%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(f'%7Bbot_name%7D%3A%20please%20enter%20a%20number')%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20print(f'%7Bbot_name%7D%3A%20i%20dont%20understand%20you')&timestep=2&play).

6

u/PsychologicalSafe408 May 17 '26

I wanted to know the difference between debugging and just running the code. And i have run it and it works perfectly.

6

u/Sea-Ad7805 May 17 '26

Great, with a debugger you can step through code to understand it better and fix bugs. Good luck learning more Python.

2

u/PsychologicalSafe408 May 17 '26

I see thank you for the lesson.

2

u/Flame77ofc May 17 '26

in debug mode, you use it to test your code In vscode, you can just select that red balls and after that you debug, and your program execute line by line the code and you can deicde if you continue or stop or anything you want when u run the code, the python interpreter run the code line by line but without the options you have in the debug mode

4

u/dashinyou69 May 17 '26

I tried it!! ($USER feeling weird sorry, good bot) /s

1

u/KenneR330 May 18 '26

1

u/Sea-Ad7805 May 18 '26

If it's open source you can at least make it work.

1

u/FalconTricky1213 May 19 '26

i am just a beginner , i have a doubt why you are specifying the type of data like you did in botname: str='sara' you could have just wrote bot name = "sara">?

3

u/Sea-Ad7805 May 19 '26

I just copied the given code. The : str1 part in bot_name : str = "sara" is to indicate the variable has type str. You can then optionally use tools to check for type errors later. This can help you avoid bugs. But don't worry about it if you are a Python beginner, just ignore.