Question: In phython Write a program that will prompt a user to input a username and a pin code. The username can contain only letters and
In phython Write a program that will prompt a user to input a username and a pin code. The username can contain only letters and numbers, and the pin can contain only numbers. The program will do the following:
Step 1
- Ask a user to enter the username
- If the username contains letters and numbers, the program will move to step 2. Otherwise, the program will ask the user to enter letters and numbers only, and will loop until only letters and numbers are entered.
Step 2
- Ask a user to enter the pin code
- If the pin contains only numbers, the program will end. Otherwise, the program will ask a user to enter numbers only, and will loop until numbers are entered.
- Add an additional constraint, so the pin can contain only 4 digits. Change the user message to reflect this change.
Which string method returns True when the string contains only letters and numbers?
| isalpha() | ||
| isdecimal() | ||
| istitle() | ||
| isalnum() |
Which method would remove whitespace characters from this string? spam = ' It is Friday '
| spam.split() | ||
| spam.rjust() | ||
| spam.strip() | ||
| spam.paste() |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
