Last active
May 11, 2023 04:39
-
-
Save s2t2/2231b73c669b8c56780f64a87a88e75b 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
import os | |
def convert_file_to_list(file_name): | |
file_path = os.path.join(os.path.dirname(__file__), file_name) | |
# read the file contents into memory | |
infile = open(file_path, 'r') | |
my_list = infile.readlines() | |
infile.close() | |
# clean the list by stripping line-breaks | |
index = 0 | |
while index < len(my_list): | |
my_list[index] = my_list[index].rstrip('\n').rstrip('\r') | |
index += 1 | |
print(my_list) | |
return my_list | |
# | |
# PARSE FILE CONTENTS INTO TWO DIFFERENT LISTS | |
# | |
popular_boy_names = convert_file_to_list('BoyNames.txt') | |
print("THERE ARE " + str(len(popular_boy_names)) + " POPULAR BOY NAMES") | |
popular_girl_names = convert_file_to_list('GirlNames.txt') | |
print("THERE ARE " + str(len(popular_girl_names)) + " POPULAR GIRL NAMES") | |
# | |
# ASK USER FOR A BABY NAME | |
# | |
baby_name = input("Please input a baby name (wrapped in quotation marks): ") | |
print("USER CHOSE BABY NAME: " + baby_name) | |
# | |
# DETERMINE IF THE NAME IS POPULAR, AND DISPLAY THE RESULTS | |
# | |
popular_boy = (baby_name in popular_boy_names) | |
print(baby_name + " IS POPULAR BOY'S NAME?: " + str(popular_boy)) | |
popular_girl = (baby_name in popular_girl_names) | |
print(baby_name + " IS POPULAR GIRL'S NAME?: " + str(popular_girl)) |
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
Jacob | |
Michael | |
Joshua | |
Matthew | |
Daniel | |
Christopher | |
Andrew | |
Ethan | |
Joseph | |
William | |
Anthony | |
David | |
Alexander | |
Nicholas | |
Ryan | |
Tyler | |
James | |
John | |
Jonathan | |
Noah | |
Brandon | |
Christian | |
Dylan | |
Samuel | |
Benjamin | |
Zachary | |
Nathan | |
Logan | |
Justin | |
Gabriel | |
Jose | |
Austin | |
Kevin | |
Elijah | |
Caleb | |
Robert | |
Thomas | |
Jordan | |
Cameron | |
Jack | |
Hunter | |
Jackson | |
Angel | |
Isaiah | |
Evan | |
Isaac | |
Mason | |
Luke | |
Jason | |
Gavin | |
Jayden | |
Aaron | |
Connor | |
Aiden | |
Aidan | |
Kyle | |
Juan | |
Charles | |
Luis | |
Adam | |
Lucas | |
Brian | |
Eric | |
Adrian | |
Nathaniel | |
Sean | |
Alex | |
Carlos | |
Bryan | |
Ian | |
Owen | |
Jesus | |
Landon | |
Julian | |
Chase | |
Cole | |
Diego | |
Jeremiah | |
Steven | |
Sebastian | |
Xavier | |
Timothy | |
Carter | |
Wyatt | |
Brayden | |
Blake | |
Hayden | |
Devin | |
Cody | |
Richard | |
Seth | |
Dominic | |
Jaden | |
Antonio | |
Miguel | |
Liam | |
Patrick | |
Carson | |
Jesse | |
Tristan | |
Alejandro | |
Henry | |
Victor | |
Trevor | |
Bryce | |
Jake | |
Riley | |
Colin | |
Jared | |
Jeremy | |
Mark | |
Caden | |
Garrett | |
Parker | |
Marcus | |
Vincent | |
Kaleb | |
Kaden | |
Brady | |
Colton | |
Kenneth | |
Joel | |
Oscar | |
Josiah | |
Jorge | |
Cooper | |
Ashton | |
Tanner | |
Eduardo | |
Paul | |
Edward | |
Ivan | |
Preston | |
Maxwell | |
Alan | |
Levi | |
Stephen | |
Grant | |
Nicolas | |
Omar | |
Dakota | |
Alexis | |
George | |
Collin | |
Eli | |
Spencer | |
Gage | |
Max | |
Cristian | |
Ricardo | |
Derek | |
Micah | |
Brody | |
Francisco | |
Nolan | |
Ayden | |
Dalton | |
Shane | |
Peter | |
Damian | |
Jeffrey | |
Brendan | |
Travis | |
Fernando | |
Peyton | |
Conner | |
Andres | |
Javier | |
Giovanni | |
Shawn | |
Braden | |
Jonah | |
Cesar | |
Bradley | |
Emmanuel | |
Manuel | |
Edgar | |
Erik | |
Mario | |
Edwin | |
Johnathan | |
Devon | |
Erick | |
Wesley | |
Oliver | |
Trenton | |
Hector | |
Malachi | |
Jalen | |
Raymond | |
Gregory | |
Abraham | |
Elias | |
Leonardo | |
Sergio | |
Donovan | |
Colby | |
Marco | |
Bryson | |
Martin |
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
Emily | |
Madison | |
Emma | |
Olivia | |
Hannah | |
Abigail | |
Isabella | |
Samantha | |
Elizabeth | |
Ashley | |
Alexis | |
Sarah | |
Sophia | |
Alyssa | |
Grace | |
Ava | |
Taylor | |
Brianna | |
Lauren | |
Chloe | |
Natalie | |
Kayla | |
Jessica | |
Anna | |
Victoria | |
Mia | |
Hailey | |
Sydney | |
Jasmine | |
Julia | |
Morgan | |
Destiny | |
Rachel | |
Ella | |
Kaitlyn | |
Megan | |
Katherine | |
Savannah | |
Jennifer | |
Alexandra | |
Allison | |
Haley | |
Maria | |
Kaylee | |
Lily | |
Makayla | |
Brooke | |
Mackenzie | |
Nicole | |
Addison | |
Stephanie | |
Lillian | |
Andrea | |
Zoe | |
Faith | |
Kimberly | |
Madeline | |
Alexa | |
Katelyn | |
Gabriella | |
Gabrielle | |
Trinity | |
Amanda | |
Kylie | |
Mary | |
Paige | |
Riley | |
Jenna | |
Leah | |
Sara | |
Rebecca | |
Michelle | |
Sofia | |
Vanessa | |
Jordan | |
Angelina | |
Caroline | |
Avery | |
Audrey | |
Evelyn | |
Maya | |
Claire | |
Autumn | |
Jocelyn | |
Ariana | |
Nevaeh | |
Arianna | |
Jada | |
Bailey | |
Brooklyn | |
Aaliyah | |
Amber | |
Isabel | |
Danielle | |
Mariah | |
Melanie | |
Sierra | |
Erin | |
Molly | |
Amelia | |
Isabelle | |
Madelyn | |
Melissa | |
Jacqueline | |
Marissa | |
Shelby | |
Angela | |
Leslie | |
Katie | |
Jade | |
Catherine | |
Diana | |
Aubrey | |
Mya | |
Amy | |
Briana | |
Sophie | |
Gabriela | |
Breanna | |
Gianna | |
Kennedy | |
Gracie | |
Peyton | |
Adriana | |
Christina | |
Courtney | |
Daniela | |
Kathryn | |
Lydia | |
Valeria | |
Layla | |
Alexandria | |
Natalia | |
Angel | |
Laura | |
Charlotte | |
Margaret | |
Cheyenne | |
Mikayla | |
Miranda | |
Naomi | |
Kelsey | |
Payton | |
Ana | |
Alicia | |
Jillian | |
Daisy | |
Mckenzie | |
Ashlyn | |
Caitlin | |
Sabrina | |
Summer | |
Ruby | |
Rylee | |
Valerie | |
Skylar | |
Lindsey | |
Kelly | |
Genesis | |
Zoey | |
Eva | |
Sadie | |
Alexia | |
Cassidy | |
Kylee | |
Kendall | |
Jordyn | |
Kate | |
Jayla | |
Karen | |
Tiffany | |
Cassandra | |
Juliana | |
Reagan | |
Caitlyn | |
Giselle | |
Serenity | |
Alondra | |
Lucy | |
Kiara | |
Bianca | |
Crystal | |
Erica | |
Angelica | |
Hope | |
Chelsea | |
Alana | |
Liliana | |
Brittany | |
Camila | |
Makenzie | |
Veronica | |
Lilly | |
Abby | |
Jazmin | |
Adrianna | |
Karina | |
Delaney | |
Ellie | |
Jasmin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment