201k views
2 votes
IN PYTHON LANGUAGE

(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. (Submit for 1 point)

Enter favorite color:
yellow
Enter pet's name:
Daisy
Enter a number:
6
You entered: yellow Daisy 6

(2) Output two passwords using a combination of the user input. Format the passwords as shown below. (Submit for 2 points, so 3 points total).

Enter favorite color:
yellow
Enter pet's name:
Daisy
Enter a number:
6
You entered: yellow Daisy 6

First password: yellow_Daisy
Second password: 6yellow6

(3) Output the length of each password (the number of characters in the strings). (Submit for 2 points, so 5 points total).

Enter favorite color:
yellow
Enter pet's name:
Daisy
Enter a number:
6
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

1 Answer

1 vote

Answer:

favorite_color = input('Enter favorite color:\\')

pet_name = input("Enter pet's name:\\")

number = input('Enter a number:\\')

print('You entered:',favorite_color+' '+pet_name+' '+number)

password1 = favorite_color+'_'+pet_name

password2 = number+favorite_color+number

print('\\First password:'+' '+password1)

print('Second password:'+' '+password2)

print('\\Number of characters in '+password1+': '+str(len(password1)))

print('Number of characters in '+password2+': '+str(len(password2)))

Step-by-step explanation:

Notice on the pet name I used quotes instead of parenthesis because so I can use the comma on pet's.

This solution worked for me.

User Shoter
by
6.3k points