16 lines
278 B
Python
16 lines
278 B
Python
# Exercise 10-11 Favorite Number
|
|
# Learning Objective: Save data in JSON format.
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
path = Path("./Chapter_10/favorite_number.json")
|
|
|
|
favorite_number = input("What is your favorite number?")
|
|
|
|
path.write_text(json.dumps(favorite_number))
|
|
|
|
|
|
|
|
|