The document provides 13 programming problems involving strings in Python. The problems cover a range of string manipulation tasks including: removing characters at odd indices; converting case; checking for substrings; counting vowels and words; calculating length without len(); finding longest word length; exchanging first and last characters; reversing words; checking palindromes; alternating characters of equal length strings; capitalizing first letters of name words; and printing a string repeated, its last 3 characters, backwards, and in all caps.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
39 views
Python String
The document provides 13 programming problems involving strings in Python. The problems cover a range of string manipulation tasks including: removing characters at odd indices; converting case; checking for substrings; counting vowels and words; calculating length without len(); finding longest word length; exchanging first and last characters; reversing words; checking palindromes; alternating characters of equal length strings; capitalizing first letters of name words; and printing a string repeated, its last 3 characters, backwards, and in all caps.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14
Summer Fields School
DLF, Phase-I, Gurugram,
Haryana
Subject: Computer Science (083) Topic: (Strings in
Python) Name ……………………..… Class & Sec: XI-…….
Date ………/2022
1. Write Program for the following:
1. Write a Python program to remove the characters which have odd index values of a str 2. Write a Python script that takes input from the user and displays that input back in upper and lower cases 3. Write a program in python to check if a Substring is present in a given String or not.
4. Write a program in python to count and display vowels in a string.
5. Write a program in python to count and display number of words in a string. 6. Write a Python program to calculate the length of a string, without using len(). 7. Write a Python function that takes a list of words and returns the length of the longest one. 8. Write a Python program to change a given string to a new string where the first and last chars have been exchanged. 9. Write a program in python to reverse words in each String in Python. 10. Write a Python program to Check Whether a String is Palindrome or Not. 11. Write a program that asks the user to enter two strings of the same length. The program should then check to see if the strings are of the same length. If they are not, the program should print an appropriate message and exit. If they are of the same length, the program should alternate the characters of the two strings. For example, if the user enters xyz and ABC the program should print out AxByCz. 12. Write a program that asks the user to enter their name in lowercase and then capitalizes the first letter of each word of their name.
13. Write a program that asks the user to enter a string and then print the following: a. The string repeated 10 times