Last active
July 17, 2023 15:43
-
-
Save crhallberg/75028fc67eee297181e0715034d27d80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"title": "Iron Flame", | |
"author": "Rebecca Yarros", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 200 | |
}, | |
{ | |
"title": "Fourth Wing", | |
"author": "Rebecca Yarros", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 112 | |
}, | |
{ | |
"title": "Beyond the Story: 10-Year Record of BTS", | |
"author": "BTS and Myeongseok Kang", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 455 | |
}, | |
{ | |
"title": "Nightmare at the Book Fair", | |
"author": "Dan Gutman", | |
"binding": "Paperback", | |
"books": 1, | |
"pages": 128 | |
}, | |
{ | |
"title": "A Court of Thorns and Roses Series (Series)", | |
"author": "Sarah J. Maas", | |
"binding": "Paperback", | |
"books": 3, | |
"pages": 208 | |
}, | |
{ | |
"title": "The Five-Star Weekend", | |
"author": "Elin Hilderbrand", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 288 | |
}, | |
{ | |
"title": "The Only One Left: A Novel", | |
"author": "Riley Sager", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 192 | |
}, | |
{ | |
"title": "The Covenant of Water", | |
"author": "Abraham Verghese", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 112 | |
}, | |
{ | |
"title": "Zero Days", | |
"author": "Ruth Ware", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 311 | |
}, | |
{ | |
"title": "Demon Copperhead", | |
"author": "Barbara Kingsolver", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 464 | |
}, | |
{ | |
"title": "The Plague of Models: How Computer Modeling Corrupted Environmental, Health, and Safety Regulations", | |
"author": "Kenneth P. Green, Benjamin Zycher (Foreword by), Steven F. Hayward (Afterword)", | |
"binding": "Paperback", | |
"books": 1, | |
"pages": 240 | |
}, | |
{ | |
"title": "Lessons in Chemistry", | |
"author": "Bonnie Garmus", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 267 | |
}, | |
{ | |
"title": "House of Flame and Shadow (Crescent City Series #3)", | |
"author": "Sarah J. Maas", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 366 | |
}, | |
{ | |
"title": "Icebreaker: A Novel", | |
"author": "Hannah Grace", | |
"binding": "Paperback", | |
"books": 1, | |
"pages": 256 | |
}, | |
{ | |
"title": "The Puzzle Master: A Novel", | |
"author": "Danielle Trussoni", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 256 | |
}, | |
{ | |
"title": "A Curse for True Love", | |
"author": "Stephanie Garber", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 184 | |
}, | |
{ | |
"title": "Cross Down: An Alex Cross and John Sampson Thriller", | |
"author": "James Patterson and Brendan DuBois", | |
"binding": "Hardcover", | |
"books": 1, | |
"pages": 92 | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Hello, world!") | |
# Python will ignore this | |
PPI = 400 | |
def calc_width(book): | |
paper_width = book["pages"] / PPI # inches | |
cover_width = 0 | |
if book["binding"] == "Hardcover": | |
cover_width = 1/4 # inches | |
else: | |
cover_width = 4 / PPI # Paperback width | |
width = paper_width + cover_width | |
return width | |
# Iron Flame Rebecca Yarros Hardcover 1 200 | |
ironflame = { | |
"title": "Iron Flame", | |
"author": "Rebecca Yarros", | |
"binding": "Hardcover", | |
"pages": 200, | |
} | |
# Fourth Wing Rebecca Yarros Hardcover 1 112 | |
fourthwing = { | |
"title": "Fourth Wing", | |
"author": "Rebecca Yarros", | |
"binding": "Hardcover", | |
"pages": 112, | |
} | |
# Beyond the Story: 10-Year Record of BTS BTS and Myeongseok Kang Hardcover 1 455 | |
btsbts = { | |
"title": "Beyond the Story: 10-Year Record of BTS", | |
"author": "BTS and Myeongseok Kang", | |
"binding": "Paperback", | |
"pages": 455, | |
} | |
book_list = [ | |
ironflame, | |
fourthwing, | |
btsbts, | |
] | |
for book in book_list: | |
book["width"] = calc_width(book) | |
print(book["width"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.google.com/spreadsheets/d/1zwlzfkHCy6d-Om4dTHQrWNy_jqgtrbaKTRgReCe-ou0/edit?usp=sharing