0
import random
from random import randint as rand
upperCase = chr(rand(65,66))
lowerCase = chr(rand(97,122))
class PasswordLetters:
    
    def __init__(self):
        pass
    
    
    def generateCapitalCaseLetter(self):
        
        uppCase = chr(rand(65,91))
        return uppCase
    
    def generateLowerCaseLetter(self):
        lowCase = chr(rand(97,122))
        return lowCase
    
    def generateSpecialLetter(self):
        specLet = random.choice(specialCharacters)
        return specLet
    
    def generateNumber(self):
        num = rand(1,99)
class PasswordGenerator:
    
    def __init__(self,uppCase,lowCase,specLet,num):
        self.uppCaseList = []
        lowCaseList = []
        specLet = []
        numList = []
        self.passLetter = PasswordLetters()
        for i in range(0,uppCase):
            self.uppCaseList.append(self.passLetter.generateCapitalCaseLetter)


password = PasswordGenerator(1,1,1,1)
password.uppCaseList

So The Problem I am facing is when I try to get uppCaseList back from my password object it comes back to me as an method in a list instead of a letter in a list. I think the problem is in my PasswordLetters class but I can't figure it out. The only thing I want is for password.uppCaseList to return a list with letters

  • 1
    `generateCapitalCaseLetter` is a method, therefore it needs to be **called**. I see from previous questions that you have some familiarity with this material. Please read https://ericlippert.com/2014/03/05/how-to-debug-small-programs/, and try to find simple problems like this yourself first before posting. – Karl Knechtel Jul 13 '22 at 02:20

1 Answers1

1

Since it's a function you are calling, it would need to include the ( open and close ) parentheses. You may refer here for explanation.

for i in range(0,uppCase):
    self.uppCaseList.append(self.passLetter.generateCapitalCaseLetter())
Raymond C.
  • 572
  • 4
  • 24