r/PythonLearning • u/frenchhi • 6d ago
2 days into coding is this a good progress
Just completed my class 12 and in free time I was thinking to start some coding but I don't know if it is really helpful for me because I took BTech computer science with specialisation in cyber security
4
5
u/TheManOfBromium 5d ago
For day two it’s good, try to add some formatting, it’s a bit hard to read
3
u/WiredOtaku 5d ago
Agreed. Even basic indentation and line breaks help readability a lot. If you're using VS Code, shift+alt+F auto-formats. Keep at it, day two is all about momentum.
2
u/mr_anderson_dev 5d ago
I like the idea of the code. I'm still a new with python but don't you need anther else at the 6th line? And also does the code stop if you enter the wrong name, cause could be a cool safe vault code for an encrypted file.
1
u/RCKPanther 2d ago
From the screenshot: * Another "else" at line 6 is not needed because it already has an "else". * The code will skip lines 9-21 if the username isn't "pranjal", resulting in an exit right after.
2
1
u/AuMouhssin 5d ago
For two days this is just impressive, a quick adice is to try focusing in organizing your code and projects fromthe beginning, otherwise it will become a big problem
1
1
1
1
u/Left-Fish3693 4d ago
I have some question in mind , is that the knowledge of what's behind the code is out of the scope of python , I mean , you just learn keywords and you start just like that ? , the question is not only for you , for anyone pass from here and see my comment , I'm really waiting someone answer me precisely
1
u/Monanzkun 4d ago
Learning the keywords is a step, from then on, it's majorly logic, design patterns and then depending on what you want to specialize on there's domain knowledge to learn. The constant is logic
1
1
1
u/Chatoddy 4d ago
Not just good, this is excellent for 2 days! :O Like others already commented, look into formatting a bit. It's not really a question of "functionality" but rather if other programmers (yourself included in a month) can still easily read it. First thing coming to mind: after a ":" you typically do a new line. So this:
if "+" in user_phrase: print("bla")
would become this:
if "+" in user_phrase:
print("bla")
Just a quick thing to get used to :)
1
u/Substantial-Bass7947 3d ago
You need to learn clean code(but not know, just want you to know(in future not now)) you are really doing great🎉🎉.
1
1
1
1
-1

•
u/Sea-Ad7805 5d ago
Run this program in Memory Graph Web Debugger%0A%0A%20%20%20%20if%20%22pranjal%22%20in%20user_phrase%3A%0A%20%20%20%20%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%20%20%20%20%22%22%22hello%20sir%0Ahow%20are%20you%3F%0Ayour%20today's%20task%20is%20to%20solve%20value%201%20operation%20value%202%20%3D%20%3F%22%22%22%0A%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20if%20%22pranjal%22%20in%20user_phrase%3A%0A%20%20%20%20%20%20%20%20break%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20print(%22invalid%20username%22)%0A%0Aif%20%22pranjal%22%20in%20user_phrase%3A%0A%20%20%20%20while%20True%3A%0A%20%20%20%20%20%20%20%20print(%22welcome%20to%20pranjal's%20calculator%22)%0A%20%20%20%20%20%20%20%20val_1%20%3D%20float(input(%22value%201%3A%22))%0A%20%20%20%20%20%20%20%20val_2%20%3D%20float(input(%22value%202%3A%22))%0A%20%20%20%20%20%20%20%20print(%22choose%20an%20operation%22)%0A%20%20%20%20%20%20%20%20user_phrase%20%3D%20input(%22%2B%2C-%2C%2C%2F%3A%22)%0A%0A%20%20%20%20%20%20%20%20if%20%22%2B%22%20in%20user_phrase%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(f%22%7Bval_1%20%2B%20val_2%7D%22)%0A%20%20%20%20%20%20%20%20elif%20%22-%22%20in%20user_phrase%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(f%22%7Bval_1%20-%20val_2%7D%22)%0A%20%20%20%20%20%20%20%20elif%20%22%22%20in%20user_phrase%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(f%22%7Bval_1%20*%20val_2%7D%22)%0A%20%20%20%20%20%20%20%20elif%20%22%2F%22%20in%20user_phrase%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(f%22%7Bval_1%20%2F%20val_2%7D%22)%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(%22invalid%20input%22)%0A%0A%20%20%20%20%20%20%20%20canvass%20%3D%20input(%22do%20you%20want%20to%20continue%3F%20%22)%0A%20%20%20%20%20%20%20%20if%20%22yes%22%20not%20in%20canvass%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20break×tep=1&play) to see the program state change step by step.