Trying to help my brother who has just started learning Python at school. He's not the brightest so any help is appreciated. I consider this quite hard for someone who has barely started, although he has missed a few lessons through illness.

Solution is welcome but please try to explain what certain lines do.

The task is to make a program that must check the password is at least 6 characters long. If it's too short, the program will give an error msg.

It should then ask the person to verify the password they've inputted, asking them to enter again.

It should check they've chosen the same password & give an error message if they haven't. It must also check it's at least 6 characters.

It should include a function, "Length()"


Recommended Answers

All 4 Replies

Python has not function Length, it does have len. You should post your code (do use the CODE tags)

A function called "Length()" I meant to say.

He doesn't have a code, not sure where to start.

Anyone please?

To get you started

pw = ''
while len(pw) < 6:
   pw = raw_input('Please enter a password at least 6 characters long\n')
   if len(pw) < 6:
      print('The password needs to be 6 characters long, not (%s)'%len(pw))
raw_input('Good Job!!!!!')
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.