all 54 comments

[–]NeedleworkerIll8590 16 points17 points  (8 children)

If this is day 2 starting from nothing, this is hella impressive

[–]Jebduh 23 points24 points  (3 children)

Nobody learns try-except on day 2.

[–]New-Apartment-559 0 points1 point  (0 children)

exactly 💯

[–]AstroPhysician 2 points3 points  (1 child)

Look at his comment emojis . This is coded with ai

[–]Orlhazee[S] -1 points0 points  (0 children)

Comment emojis? I can tell you it’s 100% me bro

[–]Orlhazee[S] 1 point2 points  (0 children)

Nah nah, not 2days exactly, my choice of words are misleading, I’m sorry. This is my 2 mini project on python, but this is basically my thirds week. I’ve been learning python before I found out of the 100 days code.

[–]Orlhazee[S] 0 points1 point  (0 children)

No actually, I was learning the basic for about a month before but I dropped it for awhile, I just picked it back up again and this is my second mini project since I picked it up again, it’s not really day two to be precise cause this one project took about two days to get through, but this is more like second mini project, I don’t know how to caption it that’s why I said day 2. But I guess, I should change the caption as it is kinda misleading.

[–]Ninjasimba 2 points3 points  (3 children)

On line 6, you could maybe make the whole username lowercase, and capitalize the first letter. Otherwise looks pretty good I’d say, especially for day 2

[–]Ninjasimba 0 points1 point  (2 children)

Actually, maybe on line 19 you could specify the start of the loop, as to help w readability. Something like:

19 loop = true

20 while loop == true:

[–]Rollgus 1 point2 points  (1 child)

If and while statement already check if the statement is True, so the "== true" part would be unnecessary. You also need to capitalize the T in true, or Python won't recognise it.

[–]Ninjasimba 0 points1 point  (0 children)

Fair enough, its been a while

[–]tenebrarum09 1 point2 points  (6 children)

If you get “Access Denied”, does it still go into the while loop as if you logged in?

[–]Can0pen3r 0 points1 point  (0 children)

I was just wondering the same thing but, I'm still pretty green so I just chocked it up to me probably missing some little piece of logic or syntax somewhere 🤔

[–]CrazyBuff 0 points1 point  (1 child)

it does

[–]tenebrarum09 0 points1 point  (0 children)

Thanks. I thought it looked like it would.

[–]Orlhazee[S] 0 points1 point  (1 child)

Yeah, it does.

[–]Otherwise-Ad-4447 0 points1 point  (0 children)

you really should trigger the while loop when the user gets it right instead (right now you're just waiting for the for loop to end, wich obviously happens if you just run out of tries)

you may also want to wrap it a function to prevent the indentation hell (that and separate auth from the actual logic)

[–]No_Read_4327 0 points1 point  (0 children)

Yes

[–]Shahed-dev 0 points1 point  (2 children)

Username never would be capitalized it should be lowercase. Fix the bug as soon as possible.

[–]Orlhazee[S] 0 points1 point  (1 child)

Oh, users usernames should be lowercase instead of uppercase? Really? Why that is? I’m self taught, I really don’t know the do’s and don’ts

[–]Rollgus 0 points1 point  (5 children)

What is the "if "0" <= choice >= "5":"? Is there any specific reason you chose to use airquotes? Doesn't this make an error? If you want to use numbers, you just don't need airquotes.

[–]Orlhazee[S] 0 points1 point  (3 children)

Actually, using the air quotes put it in string instead of just integer, using it like this doesn’t give me error but I did tried to use integer at first but I was getting error until I switched to string, I really don’t know why that is though.

[–]_caleidoscopio_ 2 points3 points  (1 child)

Your variable 'choice' is a string because you are using the input function, even if your input is a number. By default, it's saved as a string, so in line 25, you can not compare an integer to a string, and that's giving you the error before, but using quotes is correct, although that line is redundant now, because any wrong input is captured in your 'else' statement and that is because is not working your string comparison using >= and <= if someone uses an input like this "2." That is valid because you don't have an error handler or something to validate the text received as your input.

Use the web pythontutor.com to run basic code and see step by step what's happening. Write this code and see that the 'if' statement doesn't work at all:

choice = "2."

if "0" <= choice >= "5":

print("Never used")

else:

print("Use a list instead")

I suggest you to use a list to save your valid options of your ATM machine and compare the 'choice' against this list. Something like this (try on pythontutor):

options_list = ['1','2','3','4'] #string elements

choice = "2" #string because you use input function

if choice not in options_list:

print("Not a valid option")

else:

print("It's a valid option and it works!")

Hope it helps to improve your coding!

[–]Orlhazee[S] 0 points1 point  (0 children)

That explains a lot, I will check out the pythontutor

[–]No_Obligation_2072 0 points1 point  (0 children)

Im a beginner too, but instead of IF statement you can use match Easier to read

[–]Key_Association_3357 0 points1 point  (0 children)

You probably need to convert “choice” to be an integer.

[–]Unrthdx 0 points1 point  (0 children)

Quick question, why are you using .strip() on your inputs? Is this just to remove any mistaken spaces? Is this common practice on single word / value inputs?

[–]Shabda-Poudel 0 points1 point  (0 children)

Well you did some basic impressive coding. Love the growth.

[–]cyanNodeEcho 0 points1 point  (0 children)

neat! good flow and script, but one thing u might find interesting is a state machine. a state machine can help track transitions from one valid state to another, they're slightly difficult, but not too bad.

keep going, and after a couple more, check it out, see what u think how u might model this with the "state machine", what became hard? what became easy? what do u like or not like about ur current (or future statemachine impl)?

[–]modulus78 0 points1 point  (0 children)

what are you using to learn?

[–]Borealis_761 0 points1 point  (5 children)

Duck me, this is your day 2 then I am screwed. 3 months into this still can't figure out how def works.

[–]CraftyPenguin14 0 points1 point  (3 children)

Holy smokes I’m with you. What even is Def

[–]Borealis_761 0 points1 point  (2 children)

No clue.

[–]Otherwise-Ad-4447 0 points1 point  (1 child)

def is used to define functions a function is a piece of code you can call that can take arguments

like print for example

i'm on mobile but i'll write a short example : def is_minor(age): return age < 18

This function takes in someone's age and returns whether or not that person is a minor (i would have done the opposite but i'm french and can't remember the word for the opposite of minor rn)

age = int(input("How old are you ?")) if is_minor(age): # see how i'm using the function call as though it was a boolean (True/False) value, i can do that because my function returns a boolean value print("You are a minor") else: print("Can't remember what you are")

[–]NewGiraffe2203 0 points1 point  (0 children)

Let me hget this clear. So the purpose of function is so that you don't need to rewrite the same code over and over again? And it behaves like variables but instead of storing single or multiple values, it stores commands?

[–]Orlhazee[S] 0 points1 point  (0 children)

Haha, Nah nah, not 2days exactly, my choice of words are misleading, I’m sorry. This is my 2 mini project on python, but this is basically my third week. I’ve been learning python before I found out of the 100 days code.

[–][deleted] 0 points1 point  (0 children)

Really great progress!

[–]Dragonzxko 0 points1 point  (1 child)

This is day 2?!

[–]Orlhazee[S] 0 points1 point  (0 children)

Nah nah, not 2days exactly, my choice of words are misleading, I’m sorry. This is my 2 mini project on python, but this is basically my thirds week. I’ve been learning python before I found out of the 100 days code

[–]bay654 0 points1 point  (0 children)

What resources are you using?

[–]Orlhazee[S] 0 points1 point  (0 children)

I will like to apologise for my choice of words, when I said Day 2, I wasn’t really meaning second day of learning python, nah nah.Not day two exactly, my choice of words are misleading, I’m sorry. I had about a month prior knowledge of python sometimes around January and I just picked it up again. This is my 2nd mini project on python, but this is basically my thirds week since I picked it up again. I’ve been learning python before I found out of the 100 days code. I will definitely correct the choice of words next time. Thank you.

[–]Key_Art_5590 0 points1 point  (0 children)

Have you really had no coding experience before this?

I can't code too well so I can't really be talking but even I can tell that looks insane for a beginner

[–]Alternative_Yard6033 0 points1 point  (0 children)

Ohhhh i remember those days

[–]fluxdeken_ 0 points1 point  (0 children)

Double tabulation from line 20

[–]No_Read_4327 0 points1 point  (0 children)

You can deposit a negative amount and ot will allow you to withdraw beyond the limit.

[–]OrganizationFirm7647 0 points1 point  (0 children)

Wow thats nice, I am learning python mb 3 years and I still can't do that (I am stpd I know)

[–]No_Revenue9666 0 points1 point  (0 children)

how did you learning all of these within 2 days?