0% found this document useful (0 votes)
3 views1 page

String Functions Worksheet

The document outlines several programming tasks to be executed using the GDB compiler, including string manipulation and validation checks. Tasks include combining strings in an array, checking username length, validating a 4-digit pin, converting a name to uppercase, and reversing a string in uppercase. Additionally, it requests the exploration of two string functions from a provided link, with a requirement to document their names and purposes.

Uploaded by

anaaya.m2404
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

String Functions Worksheet

The document outlines several programming tasks to be executed using the GDB compiler, including string manipulation and validation checks. Tasks include combining strings in an array, checking username length, validating a 4-digit pin, converting a name to uppercase, and reversing a string in uppercase. Additionally, it requests the exploration of two string functions from a provided link, with a requirement to document their names and purposes.

Uploaded by

anaaya.m2404
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Do the following programs on GDB compiler and then write the

code in your journal.

Q1. Example that combine strings with an array:

wordArray = [“I", “am", “extremely", “Thankful"]

Output the length of each word in the array.

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

String Function Name Purpose

You might also like