Help
Contact
For teachers and institutes
Search courses, problems, tests…
A
A
>_
StemPy Lab
Courses ▾
Problems ▾
Practice ▾
Mock Tests
Classes
Groups
Community ▾
A
A
Problems
/
Python Going Further
/
Files and Data Formats
Files and Data Formats
Python Programming
+ Upload a Problem
More in Python Going Further
Classes and Objects
Inheritance and Special Methods
Files and Data Formats
Comprehensions, Iterators and Generators
Data Structures
Testing and Debugging
All Levels
High School (9–10)
High School (11–12)
Undergraduate
General
All
Easy
Medium
Sort
Mixed
Newest first
Oldest first
A to Z
11 problems
Type:
Any
Conceptual
Python-Coded
1.
A to-do list is kept in a JSON file as a list of texts.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Medium
2.
Write load_list(name) that gives the list that is saved in a JSON file.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Medium
3.
For data = {"p": (1, 2), 3: "x", "t": {"a"}}, say what json.dumps(data) does, and what you must…
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Medium
4.
Write a CSV file scores.csv with the header name,score and the rows Asha,72 and Rao, Ravi,85 (the…
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Easy
5.
A CSV text has the header item,price,quantity and the rows pen,10,3, book,80,1 and bag,450,2.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Medium
6.
A file marks.txt holds Asha:72, Ravi:85, Meera:64, one on each line.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Medium
7.
Write a function longest_line(name) that gives the longest line of a file, without its new line.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Easy
8.
Make a file poem.txt with the three lines roses are red, violets are blue and sugar is sweet.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Medium
9.
A file nums.txt has one number on each line: 4, 9, 2, 7.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Easy
10.
Write a function read_number(name) that reads a file with one whole number in it, and gives the…
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Medium
11.
A file visits.txt is made with "w", and the line Asha is written.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data Formats
StemPy Lab
Easy