[Python] How can I get the correct output in this program?

Discussão em 'Python' iniciado por Stack, Abril 7, 2025.

  1. Stack

    Stack Membro Participativo

    (1)Prompt the user to enter two words and a number, storing each into separate variables. Then, output those three values on a single line separated by a space. (2) Output two passwords using a combination of the user input. Format the passwords as shown below. (3) Output the length of each password (the number of characters in the strings).

    The following is the code I am using to complete this program but I am running into an output error.

    def userdetails():
    words = input("Enter a word: ")
    word2 = input("Enter a word: ")
    numm = input("Enter a number: ")

    pw1 = words+"_"+word2
    pw2 = numm+words+numm

    print("You entered: {} {} {}" .format(words,word2,numm))

    print("First password:",pw1)
    print("Second password:",pw2)

    print("Number of characters in",pw1,":",len(pw1))
    print("Number of characters in",pw2,":",len(pw2))

    userdetails()


    Input yellow Daisy 6

    Your output

    Enter a word: Enter a word: Enter a number: You entered: yellow Daisy 6 First password: yellow_Daisy Second password: 6yellow6 Number of characters in yellow_Daisy : 12 Number of characters in 6yellow6 : 8

    Your output does not contain You entered: yellow Daisy 6

    First password: yellow_Daisy Second password: 6yellow6

    I don't know what to do to get the rest of this correct for all the points needed can anyone help me?

    Continue reading...

Compartilhe esta Página