Strings In Python
Assignment helps in increasing the student’s knowledge, his research skills, and his analysis power. It helps in judging one’s performance with others. Some students mug up the course work and at the time of the exam they just write down what they have mugged up.
It means you are provided with a topic or a case study with some information about it, you need to incorporate the information and explain the topic or solve the case study. Simply copy-pasting from outside sources are of no help until and unless you have understood what you are being asked to write.
From the beginning of the learning process, students are given certain assignments and homework, to develop their critical and analytical skills. In the initial stages, i.e. if we talk about the elementary schooling part, the complexity level of such assignments remains low, but as a student enters some college or university, the assignments turn into a more complicated and sophistical thing. Though, many of us might still question why we are given assignments, and what is the main purpose behind it? Well, there are many intentions behind giving assignments and homework to students.
With the help of assignments, students get to learn new techniques and specific writing tips that assist them in their academics. Continuous practice is required if you want to excel in this field. Practice leads to an improvement in one’s skills or grabbing a grip on some subject. Thus, assignment writing and homework is a means of this exercise. When students write assignments or do their homework, they come across new problems and equations and discover its relevant solutions on their own, which is why they are given this task to complete at home. The practice also benefits the students by getting them ready for certain unpredicted situations.
Assignment 1: Level: Easy
1. WAP to calculate the length of a string.
2. Write a Python program to remove a newline in Python.
3. Write a Python program to reverse a string.
4. Write a Python program to remove spaces from a given string.
5. Write a Python program to display a number with a comma separator.
6. Write a Python program to print four values decimal, octal, hexadecimal (capitalized), binary in a single line of a given integer.
7. Write a Python script that displays the string in upper and lower cases.
8. Write a Python program to print the index of the character in a string.
Sample string: Digital |
Expected output: |
character D position at 0 |
character i position at 1 |
character g position at 2 |
------------------------------ |
character l position at 6 |
9. By making use of string slicing print the output as:
[D i l o u t]
Take a= 'Digital Community'
10. By making use of string slicing print the output as:
[y i u m C l t g D]
Take a= 'Digital Community'
11. WAP to concatenate two strings.
12. By making use of string slicing print the output as:
[Y u N m]
Take a='Your Name'
13. WAP to print the output : [ gita ]
Take a='Digital Community'
If You have any doubts about the above mention any question then please ask it in the comment section we will try to help you and solve it as soon as possible.
We hope these questions was helpful in making your concepts more clear. So make sure to share this post to help others and if these assignments really helped you a bit then also leave a comment below sharing your thoughts.
No comments:
Post a Comment
If you have any doubts, let me know.