SlideShare a Scribd company logo
2
Most read
1
CHAPTER: STRING IN PYTHON
ASSIGNMENT SET – 1
Time: 30 min M.M. – 20
Instructions:
 All Questions are compulsory
 Q1 to Q6 carry 1 mark
 Q7 to Q10 carry 2 marks
 Q11 to Q12 carry 3 marks
Q1. Write the code to create an empty string named “str”.
Q2. Name the function which count the total number of characters in a
string.
Q3. Fill the index value in place of ‘?’ so that the output should come ‘o’
str = “csiplearninghub.com”
print(str[?])
Q4. Write the function which removes the spaces from the left side of
the string.
Q5. What type of error is returned by the following statement?
str = “csiplearninghub.com”
str[7] = ‘e’
Q6. What do you mean by concatenation of string?
2
Q7. Write a program to accept a string and display in reverse.
Q8. Write a function count( ) in python which takes string as argument
and return total number of words.
Q9. Write the output of the following:
a. print(“Suman” > “Sumati”)
b. print(“amit”.isalpha())
Q10. Write the output of the following code :
str = "CSIPLearningHuB"
newstr = " "
for i in range(len(str)):
if str[i].isupper():
newstr =newstr + str[i].lower()
if str[i].islower():
newstr =newstr + str[i].upper()
print(newstr)
Q11. Write a program in python that accept a string from the user and
display the following:
1. Total number of vowels
2. Total number of digits
3. Total number of words.
3
Q12. Write the output of the following:
str = "CSIPLearningHuB"
print(str[::-1])
print(str[-7:-1:2])
print(str[3:14:3])

More Related Content

PPTX
HTML: Tables and Forms
PPTX
HTML iframe
PPTX
10 동기및비동기장치io
PPTX
Bootstrap Web Development Framework
PDF
Useful Linux and Unix commands handbook
PDF
PHP Basic & Variables
PPTX
Mô hình MVC trong lập trình web với Java
PPTX
PHP File Handling
HTML: Tables and Forms
HTML iframe
10 동기및비동기장치io
Bootstrap Web Development Framework
Useful Linux and Unix commands handbook
PHP Basic & Variables
Mô hình MVC trong lập trình web với Java
PHP File Handling

What's hot (20)

PDF
Bài Giảng Môn Học Cơ Sở Dữ Liệu Nâng Cao
PDF
Lập trình Shell 1.pdf
PDF
Build a Website Using HTML + CSS
DOC
120 cau mon quan tri mang public_sv
PDF
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
PPTX
Tablas html.pptx
PDF
Course 102: Lecture 13: Regular Expressions
PDF
GDB와 strace로 Hang 걸린 Python Process 원격 디버깅
PDF
Bài giảng sql server 2008
PPT
Intro to Rails ActiveRecord
PDF
Introduction to Git Version Control System
PPTX
C++ Memory Management
PPTX
Bootstrap 3
PPT
Cocomo – constructive cost model
PDF
Php introduction
PDF
Tài liệu lập trình PHP từ căn bản đến nâng cao
PPT
Javascript arrays
PPTX
Introdução a HTML5
PDF
CSS Day: CSS Grid Layout
Bài Giảng Môn Học Cơ Sở Dữ Liệu Nâng Cao
Lập trình Shell 1.pdf
Build a Website Using HTML + CSS
120 cau mon quan tri mang public_sv
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Tablas html.pptx
Course 102: Lecture 13: Regular Expressions
GDB와 strace로 Hang 걸린 Python Process 원격 디버깅
Bài giảng sql server 2008
Intro to Rails ActiveRecord
Introduction to Git Version Control System
C++ Memory Management
Bootstrap 3
Cocomo – constructive cost model
Php introduction
Tài liệu lập trình PHP từ căn bản đến nâng cao
Javascript arrays
Introdução a HTML5
CSS Day: CSS Grid Layout
Ad

Similar to CBSE Python String Assignment (20)

DOCX
CBSE Class 12 Computer practical Python Programs and MYSQL
PDF
gdscpython.pdf
PDF
accenture Advanced coding questiosn for online assessment preparation
PPTX
C# introduzione per cibo e altri usi vati
PDF
PROBLEM SOLVING USING A PPSC- UNIT -3.pdf
PDF
Sample Program file class 11.pdf
PDF
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
DOCX
D422 7-2 string handeling
DOCX
D422 7-2 (2)
DOCX
D422 7-2 string hadeling
DOCX
D422 7-2 string handeling
DOCX
D422 7-2 (3)python
DOCX
Functions Practice Sheet.docx
PPTX
Virtusa questions placement preparation guide
PDF
Advanced Web Technology ass.pdf
PPTX
POEPPSGNHwkejnkweoewnkenjwjewkjewoewkjewijewjk
PPTX
C programming
DOCX
703497334-ICSE-Class-9-Computer-Applications-Sample-Question-Papers.docx
PPTX
The Input Statement in Core Python .pptx
PDF
Programming Fundamentals presentation slide
CBSE Class 12 Computer practical Python Programs and MYSQL
gdscpython.pdf
accenture Advanced coding questiosn for online assessment preparation
C# introduzione per cibo e altri usi vati
PROBLEM SOLVING USING A PPSC- UNIT -3.pdf
Sample Program file class 11.pdf
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
D422 7-2 string handeling
D422 7-2 (2)
D422 7-2 string hadeling
D422 7-2 string handeling
D422 7-2 (3)python
Functions Practice Sheet.docx
Virtusa questions placement preparation guide
Advanced Web Technology ass.pdf
POEPPSGNHwkejnkweoewnkenjwjewkjewoewkjewijewjk
C programming
703497334-ICSE-Class-9-Computer-Applications-Sample-Question-Papers.docx
The Input Statement in Core Python .pptx
Programming Fundamentals presentation slide
Ad

Recently uploaded (20)

PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Digestion and Absorption of Carbohydrates, Proteina and Fats
PDF
advance database management system book.pdf
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
IGGE1 Understanding the Self1234567891011
PDF
RMMM.pdf make it easy to upload and study
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
Lesson notes of climatology university.
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Classroom Observation Tools for Teachers
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Indian roads congress 037 - 2012 Flexible pavement
PPTX
History, Philosophy and sociology of education (1).pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Computing-Curriculum for Schools in Ghana
Digestion and Absorption of Carbohydrates, Proteina and Fats
advance database management system book.pdf
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Weekly quiz Compilation Jan -July 25.pdf
What if we spent less time fighting change, and more time building what’s rig...
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
UNIT III MENTAL HEALTH NURSING ASSESSMENT
IGGE1 Understanding the Self1234567891011
RMMM.pdf make it easy to upload and study
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Lesson notes of climatology university.
Chinmaya Tiranga quiz Grand Finale.pdf
Classroom Observation Tools for Teachers
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Indian roads congress 037 - 2012 Flexible pavement
History, Philosophy and sociology of education (1).pptx

CBSE Python String Assignment

  • 1. 1 CHAPTER: STRING IN PYTHON ASSIGNMENT SET – 1 Time: 30 min M.M. – 20 Instructions:  All Questions are compulsory  Q1 to Q6 carry 1 mark  Q7 to Q10 carry 2 marks  Q11 to Q12 carry 3 marks Q1. Write the code to create an empty string named “str”. Q2. Name the function which count the total number of characters in a string. Q3. Fill the index value in place of ‘?’ so that the output should come ‘o’ str = “csiplearninghub.com” print(str[?]) Q4. Write the function which removes the spaces from the left side of the string. Q5. What type of error is returned by the following statement? str = “csiplearninghub.com” str[7] = ‘e’ Q6. What do you mean by concatenation of string?
  • 2. 2 Q7. Write a program to accept a string and display in reverse. Q8. Write a function count( ) in python which takes string as argument and return total number of words. Q9. Write the output of the following: a. print(“Suman” > “Sumati”) b. print(“amit”.isalpha()) Q10. Write the output of the following code : str = "CSIPLearningHuB" newstr = " " for i in range(len(str)): if str[i].isupper(): newstr =newstr + str[i].lower() if str[i].islower(): newstr =newstr + str[i].upper() print(newstr) Q11. Write a program in python that accept a string from the user and display the following: 1. Total number of vowels 2. Total number of digits 3. Total number of words.
  • 3. 3 Q12. Write the output of the following: str = "CSIPLearningHuB" print(str[::-1]) print(str[-7:-1:2]) print(str[3:14:3])