String Functions Worksheet
String Functions Worksheet
Q2
Amy wants to set a username for her new email account. Write a program
to check if the username has at least 5 characters. If not, display an error
message: "Username too short."
Q3
John is creating a pin for his bank account. The pin must be exactly 4
digits long. Write a program that checks if the pin is valid and displays "Pin
is valid" or "Invalid pin. Please enter a 4-digit number."
Q3:
Write a program that accepts a user’s name and prints it in all uppercase
letters using the upper() function.
Q5
Write a program to input a string and print the string in reverse, but all
characters should be in uppercase in the reversed string.
Example:
Input: hello
Output: OLLEH
Q6.Try out any 2 string functions using the following link and
write their name and explanation of it in the space given below
https://www.w3schools.com/python/python_ref_string.asp