Skip to content

Latest commit

 

History

History
33 lines (20 loc) · 1.65 KB

Practice_code6.md

File metadata and controls

33 lines (20 loc) · 1.65 KB
title subtitle
Strings Practice
Practice Code 6

This Notebook Contains practice question for the note on Strings.

Try working online at:
Coding Ground - Tutorials Point
Online Compiler and Debugger

Q1: Write a program to get a string and print its reverse as output.

Q2: Write a program to get a string and print elements in odd position as output.

Q3: Write a program to get a string and print elements in even position as output.

Q4: Write a program to get a alphabetic string and print vowels in them as output.

Q5: Write a program to get a string and print digits in them as output.

Q6: Write a program to get a string s and a substring x and print if the x is present in s as output.

Q7: Write a program to get a string and set the first letter of all the words in the string to upper case and print the modified string as output.

Q8: Write a program to get a name from the user and print if it is a valid name as output.
Condition: Name is valid if contains only alphabets and there are at least 1 uppercase and 1 lowercase characters.

Q9: Write a program to get a variable name, replace all the white spaces with an underscore " _ " and print the modified string as output.

Q10: Write a program to get a string and print all the elements sorted in the alphabetical order as output.

Q11: Write a program to get a string and print the words in them in lexicographic order as output. The words in the string are delimited by a single whitespace (' ').