0% found this document useful (0 votes)
3 views2 pages

Program Practice Set 2

The document outlines a practice set of programming tasks focused on functions, file handling, binary files, CSV file handling, and stack data structures. Each section contains specific functions to implement, such as updating list values, counting characters in strings, reading from text files, and managing data in binary and CSV formats. The tasks are designed to enhance programming skills in various areas including data manipulation and file operations.

Uploaded by

Aradhya Rawat
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)
3 views2 pages

Program Practice Set 2

The document outlines a practice set of programming tasks focused on functions, file handling, binary files, CSV file handling, and stack data structures. Each section contains specific functions to implement, such as updating list values, counting characters in strings, reading from text files, and managing data in binary and CSV formats. The tasks are designed to enhance programming skills in various areas including data manipulation and file operations.

Uploaded by

Aradhya Rawat
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

Day-2 Programs Practice Set (Board Oriented)

1. Functions
1. List Update: Write a func Change_Val(L) where elements divisible by 5
are replaced by their square, and others are incremented by 10.
2. String Stats: Write a func Count_Alpha(S) to count and display total
number of Lowercase vowels and Special characters in string S.
3. Global Scope: Create a program to demonstrate the use of global
keyword by updating a variable Score inside a func Update().
4. List Filter: Write a func Get_Short(Names) that returns a new list of
names that have exactly 4 characters.
5. Argument Types: Create a func Calc_Volume(L, B=10, H=5) and show
how to call it using positional and keyword args.
2. Text File Handling
1. Word Search: Write a func Search_Word() to read "[Link]" and
count how many times words "is" or "are" appear.
2. Line Logic: Write a func Start_Digit() to display all lines from "[Link]"
that start with a number (0-9).
3. Vowel Count: Write a func Total_Vowels() to count total number of
vowels (A, E, I, O, U) in "[Link]".
4. Specific Display: Write a func Small_Words() to print all words from
"[Link]" whose length is less than 3.
5. File Shift: Write a func Move_Lines() to copy all lines from "[Link]" to
"[Link]" that contain the word "Error".
3. Binary File
1. Add Data: Write a func Add_Record() to input BookID, Title, and Author
and save as a list in "[Link]".
2. Search ID: Write a func Find_Book(BID) to search for BookID in
"[Link]" and print its Title. Show "Missing" if not found.
3. Price Update: Write a func Revise_Price(ID, NewP) to find Product ID in
"[Link]" and update its Price to NewP.
4. Filter Records: Write a func High_Scorers() to read "[Link]" and
display names of players with score > 100.
5. File Copy: Write a func Filter_Copy() to copy records from "[Link]" to
"[Link]" where Age is above 60.
4. CSV File Handling
1. Create CSV: Write a func New_User() to store UserID, Username, and
Dept in "[Link]".
2. Search CSV: Write a func Find_Dept(User) to read "[Link]" and
print the Dept of the given Username.
3. Tabular View: Write a func View_Stock() to read "[Link]" and
display data in a clean table format.
4. Counter: Write a func Count_Dept(DName) to count how many
employees in "[Link]" belong to "Sales" dept.
5. Price Logic: Write a func Budget_Items() to read "[Link]" and display
names of items with Price between 500 and 1000.
5. Stack Data Structure
1. Odd Stack: Write Push_Odd(Nums) and Pop_Odd(S) to push only odd
numbers from a list into stack and then pop.
2. Dict Filter: Given a dict {'Item': Price}, write Push_Costly(D) to push item
names into stack if Price > 1000.
3. Consonant Stack: Write Push_Con(Words) to push words starting with a
consonant into stack and Pop_Con() with Underflow check.
4. List Stack: If list is [Roll, Name, Grade], write a func to push only Names
into stack for students with Grade 'A'.
5. Full Stack Op: Write a menu-driven code for Push, Pop, and Display
operations for a stack of 'Mobile' names.

You might also like