Example HTML page

Python Exercise 6

The following are the examples  related to slicing in the string data type.I have given the string ‘character_set’,  Write the single line of code to get the required result for the given string. 

character_set=”ABCDEFGHIJKLMNOPQRSTUVWXYZ$%^&abcdefghijklmnopqrstuvwxyz”

1. Print the first character using negative indexing.
2. Print the last character using positive indexing.
3. Print the Uppercase letters and store it in another string UPPER.
4. Print the lowercase letters and store it in another string LOWER.
5. Print the letters between ‘P’ to ‘p’ using positive indexing
6. Print the letters between ‘Z’to ‘f’ using negative indexing.
7. Store the Uppercase letters in to another string using negative indexing.
8. Store the Lowercase letters in to another string using negative indexing.
9. Print the even indexed Upper case letters using positive indexing.
10. Print the odd indexed Upper case letters using positive indexing.
11. Print the even indexed Lower case letters using negative indexing.
12. Print the odd indexed Lower case letters using negative indexing.
13. How many characters are in between ‘P’ to ‘p’ using positive indexing.
14. How many characters are in between ‘X’ to ‘x’ using negative indexing.
15. Print the Special Characters in the string using positive indexing.

Example HTML page

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest