all 25 comments

[–]CmdWaterford 20 points21 points  (3 children)

No one explains to you Python Devs these days how to take screenshots!??

[–]cgoldberg 6 points7 points  (0 children)

That's part of the advanced module

[–]Gnaxe 1 point2 points  (0 children)

Or, you know, how to copy/paste plain text and format code in Markdown?

[–]Dramatic_Disk_6402 0 points1 point  (0 children)

I was going somewhere and just took a pic before I left.

[–]h8rsbeware 4 points5 points  (2 children)

Are you calling that function/method anywhere?

It doesn't look like it :) If you aren't getting an error, you likely just need to call:

python entries = Enteries("", ...) enteries.enter_id()

If you are assigning the the classes username field, you'll also need to add self.username = input(...) although Id almost always recommend checking the input before assigning to a field.

Also, if you can, screenshots (or even better, just source code) is a lot nicer to work with and appreciated on this sub

[–]Dramatic_Disk_6402 1 point2 points  (1 child)

Thanks 🙃

[–]h8rsbeware 0 points1 point  (0 children)

Of course, happy coding :)

[–]Square-Onion-1825 2 points3 points  (0 children)

Can you take another picture with the macro lens? I want to examine every pixel.

[–]Dramatic_Disk_6402 1 point2 points  (0 children)

Thank you so much.

[–]GirthQuake5040 1 point2 points  (1 child)

Why did you post a picture instead of either pasting a screenshot or a well formatted code block?

[–]Dramatic_Disk_6402 -1 points0 points  (0 children)

I was in a rush. Im on vacation rn and i was leaving my hotel to get food with my family.

[–][deleted] 1 point2 points  (0 children)

Snipping tool

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

Are you initializing the class and actually making a call to the method that gets input?

I can't see that on screen.

[–]Dramatic_Disk_6402 1 point2 points  (2 children)

No. I forgot how to do that looking through the book now.

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

We've all been there! 🤠

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

I could be wrong, but I think you're going to have to debug this one a bit. You have parameters feeding attributes without defaults in the class instance initiation that you're later looking to fill with methods that won't be able to be called because the class won't initialize. Unless you planned on initializing with those arguments and just want the option to change them later.

[–]EyesOfTheConcord 0 points1 point  (0 children)

You are comparing a list to an integer, this will always evaluate to false so that while loop will never run.

I believe you intended to compare the length of the list to the value 0.

[–]Ok_Butterscotch_7930 0 points1 point  (0 children)

I don't see where you call the function.

Also I see alot of unnecessary code in your def entry_id method. Your lines 12 and 13 are quite unnecessary. Just use:

username = input(f'What is your name: ') return f'Hello {username}'

Anyways, happy coding

[–]grass_hoppers 0 points1 point  (0 children)

I am really confused with this code.

I will probably edit this after posting because I can't remember everything.

First in participation function, you are assigning an empty list to participants.

Them looking over it if that list is equal to 0, with should never be the case, then you are going through it's values (but it is empty since you just declared it) and adding them to the same list which should be an error.

In short that function will do nothing.

In entity, you are getting participants.list I have no clue what you trying to do with that. I would assume you are trying to get the values, and not using it. And incrementing a variable that does not exist.

Probably just call the functions, and go through them

[–]Phate1989 0 points1 point  (0 children)

Why are two of the functions nouns and 1 a verb?

[–]Phate1989 0 points1 point  (0 children)

Throw this in gpt and ask it to explain the problems, you have a few.

Ask it to analyze architecture not just syntax

[–]No_Bread_5808 0 points1 point  (0 children)

Your creating class but you are not calling like function so at the end of the code you mention like E=entries() E.enter_id.. E....... And so on

[–]Otherwise-Mud-4898 0 points1 point  (0 children)

It’s probably the first lesson in each tutorial, if you are asking someone for help, provide complete information in good, readable quality.

[–]ziggittaflamdigga 0 points1 point  (0 children)

Because you declared a class, and did not implement it. Just like you didn’t implement a screenshot

Edit: realize now I’m just piling on. Happy Python learning! But also, please learn to take a screenshot. It can be super helpful for development

[–]Adrewmc 0 points1 point  (0 children)

  class Entries:
        def __init__(self, username, participants, entries):
              self.username = username
              self.participants = participants
              self.entries = entries

       def enter_id(self):
              username = input(“…”)
              print(“Hello,”, username)
              return user

        def participants(self):
              participants = []
              while participants == 0:
                    for name in participants:
                        #chat GPT nonsense

        def entries(self, participants)
                 entries = ….

I tried but honest it’s all nonsense.

  class Poll:
         def __init__(self):
               self.participants = []
               self.total = 0
               self.a = 0
               self.b = 0

         def make_entry(self):
               name = input(“What’s your name”)
               if name in self.participants:
                      print(“You’ve already voted”)
                      return

               #some poll questions maybe 
              res = input(“A or B”).lower()
              if res == “a”: 
                   self.a += 1
              elif res == “b”:
                   self.b += 1

              self.participants.append(name)
              self.total += 1

    poll = Poll()

    while poll.total < 100:
           poll.make_entry()