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()"


6 Years
Discussion Span
Last Post by ihatehippies

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

Edited by happygeek: fixed formatting


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

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


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!!!!!')
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.