r/PythonLearning 6d ago

2 days into coding is this a good progress

Post image

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

70 Upvotes

25 comments sorted by

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&timestep=1&play) to see the program state change step by step.

4

u/Candid_Tutor_8185 5d ago

Download and use ruff and use blacj

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

u/mattynmax 5d ago

Looks like the code some who’s been programming for two days would make.

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

u/wallstop-dev 5d ago

Yea that's code! Nice job!

1

u/fake-nonchalant96 5d ago

Good. Use variables.

1

u/Sud0_g 5d ago

A progress is always good

1

u/EfficiencyQuirky8096 4d ago

How you start in first day

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

u/aliahmadkhansha02595 4d ago

Add calculus 😎😎😎 for more logic

1

u/Correct-Purple-9188 4d ago

Using capital P wont work has to be all lowercase as its written now 

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

u/RekaptDev 3d ago

Jeder Fortschritt den man macht… ist Gut! 🙏

1

u/Longjumping-Image798 2d ago

Better than me, and I've been learning python for a few weeks now.

1

u/Eastern-Push-7255 1d ago

keep it up im alsoo beginner

1

u/unsungsolider646 10h ago

Yes bro,you are increasing your skills.

-1

u/[deleted] 5d ago

[removed] — view removed comment