HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClassesGroups

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Blog

Account

  • Dashboard
  • My Content
  • Profile
  • Log in
© 2026 senLearn. All rights reserved.HelpAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /Python Going Further
  3. /Files and Data Formats

Files and Data Formats

Python Programming
+ Upload a Problem
More in Python Going FurtherClasses and ObjectsInheritance and Special MethodsFiles and Data FormatsComprehensions, Iterators and GeneratorsData StructuresTesting and Debugging
11 problems
Type:
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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy 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 FormatsStemPy LabStemPy Lab
Easy