0% found this document useful (0 votes)
98 views3 pages

L3 11 CS 2022-2023

This document contains 13 programming problems to be solved in Python. The problems involve accepting input from the user like strings and integers, and then displaying outputs in various patterns or performing tasks like checking for palindromes, encoding strings, finding vowels/consonants/digits, and implementing a two-player word guessing game. Students are instructed to write Python programs to solve each problem, include comments identifying the problem and author, and paste sample outputs. Hardcopies of programs must be printed, signed by the teacher, and added to the practical file along with an index entry.

Uploaded by

aarav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views3 pages

L3 11 CS 2022-2023

This document contains 13 programming problems to be solved in Python. The problems involve accepting input from the user like strings and integers, and then displaying outputs in various patterns or performing tasks like checking for palindromes, encoding strings, finding vowels/consonants/digits, and implementing a two-player word guessing game. Students are instructed to write Python programs to solve each problem, include comments identifying the problem and author, and paste sample outputs. Hardcopies of programs must be printed, signed by the teacher, and added to the practical file along with an index entry.

Uploaded by

aarav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Delhi Public School, R.K.

Puram Computer Science

1. Write a program in Python to accept an integer value in variable N from the user and display its
content in the following patterns.
Sample output:
Enter Integer: 5
1 54321 1
12 4321 121
123 321 12321
1234 21 1234321
12345 1 123454321

2. Write a program in Python to accept an integer value in variable N from the user and display its
content in the following patterns.
Sample output:
Enter Integer: 5
1 1 1
22 22 222
333 333 33333
4444 4444 4444444
55555 55555 555555555

3. Write a program in Python to accept a string from a user and display its content in the following
patterns.
Sample output:
Enter String: GOGREEN
G GOGREEN G
GO GOGREE GO
GOG GOGRE GOG
GOGR GOGR
GOGR
GOG
GOGRE GOGRE
GO
GOGREE GOGREE
G
GOGREEN GOGREEN

4. Write a program in Python to accept a string from a user and display its content in the following
patterns.
Sample output:
Enter String: WATER
W R W W
A E A A
T T T T
E A E E
R W R

5. Write a program in Python to accept a string from the user and show only non vowels (display
underscore _ symbol in place of vowel).
Sample output:
Enter String: WATER Enter String: PEACE
W_T_R P_ _C_

Programming Practical List 3 CScXI/2022_2023/L3 #1/3


Delhi Public School, R.K.Puram Computer Science

6. Write a program in Python to accept a word WRD and a sentence STC as strings from the user.
Find the presence or absence of the word WRD in the sentence STC (Without using in operator).
Sample output:
Sentence: A small box in the big box
Word: box
Status: Found
7. Write a program in Python to accept a sentence as a string from the user. Find the total number
of words present in the string (Without using in operator)
Sample output:
Sentence: A small box in the big box
Total Number of Words: 7
8. Write a program in Python to accept a word WRD and a sentence STC as strings from the user.
Find the positions of each occurrence of word WRD in the sentence STC. (Can use split() function)
Sample output:
Sentence: A small box in the big box
Word: box
Positions: 8, 23,
9. Write a program in Python to accept a string S from a user and display an encoded content of S
containing the reverse of the first 3 characters and last 3 characters.
Sample output:
Enter S: HALF OF THE TEAM Enter S: MOHAN'S TEAM SCORED 345
Coded S: LAHEAM Coded S: HOM345
10. Write a program in Python to accept a string S from a user and display an encoded content of S
containing the reverse of characters of second half of S and original order of characters of first
half of the S.
Sample output:
Enter S: ABCDEFGHI Enter S: ABCDEFGH
Coded S: EFGHIDCBA Coded S: EFGHDCBA
11. Write a program in Python to accept a string from a user and display the count of occurrence of
vowels, digits and consonants in it.
Sample output:
Enter Message: SAVE WATER Enter Message: 10 HAFTE 10 BAJE
VOWELS: 4 VOWELS: 4
CONSONANTS: 5 CONSONANTS: 5
DIGITS: 0 DIGITS: 4
12. Write a program in Python to accept a string from a user and check if it is Palindrome or not.
Sample output:
Enter String: NITIN Enter String: DELHI
It is a PALINDROME It is not a PALINDROME

13. Write a Python code to create a two player word guessing game with the help of following steps.
1. Accept a string Str from User1 [accept only those strings, which are less than 10 alphabets]
2. Scroll the screen with the help of print statements to hide the User1’s string.
3. Display the content of string by showing consonants’ position as underscore _ and vowels as

Programming Practical List 3 CScXI/2022_2023/L3 #2/3


Delhi Public School, R.K.Puram Computer Science

it is. Name it as GuessedStr


4. Accept a single alphabet from User2
5. If alphabet entered by the User2 matches with one of the alphabets of User1’s string,
re-display the GuessStr with the alphabet at appropriate place
6. Repeat steps 4 and 5 till the user consumes his 10 chances of guessing all the correct letters
of Str.
7. At the end display score as 20 - No. of attempts by User2. Deduct 2 points for every re-input
of the same alphabet again.
Sample output:
User1 String: WATER CONSERVATION
Re-Enter [Not more than 10 letters]
User1 String: WATER
:
:
Hint: _A_E_
User2 Guess [1]: U
** U not matching with any
User2 Guess [2]: W
Hint: WA_E_
User2 Guess [3]: K
** K not matching with any
User2 Guess [4]: W
** You lose 2 points for re-entering the same letter
User2 Guess [5]: R
Hint: WA_ER
User2 Guess [6]: T
Great - Well done, you guessed right, it is WATER
Your Score: 12
[i.e. Full score 20 - Penalty 2 - Number of Times 6]

IMPORTANT: REFER TO MORE QUESTIONS GIVEN IN ASSIGNMENT BOOKLET


General Instructions:
i. Type the solutions of all the problems using Python Language on Python IDLE or
colab.research.google.com
ii. Type in the following on top of each of your program as comment lines
# --------------------------------------------------------------#
# List-Program No : L3-P1
# Developed By : Sukrit Joy
# Date : 17-Oct-2022
# --------------------------------------------------------------#
iii. On successful execution with meaningful data, copy and paste the sample output at the bottom
of the program as comment lines.
iv. “Turn in” the softcopy of the programs as a single document in response to this assignment
submission with each program on separate pages. Once verified by the teacher, take out a
hardcopy of each program on separate pages from the printer and get them signed by the
respective computer teacher. Add all the printouts in the practical file and get the Index entry
also signed.
v. Recommended Font, “Courier New”, Style “Bold” Size “10” for all programs with single line
spacing. Default indentation 2 Character only.

Programming Practical List 3 CScXI/2022_2023/L3 #3/3

You might also like