Re: Anyone know the solution
On Mon, 27 Oct 2014 08:10:04 -0700, emmanueloje wrote: Write a program ... Hey dudester I coded a solution for you, you can get it here: http://www.sined.co.uk/tmp/names.py.txt Make sure you leave all the comments in so your instructor realises how much effort you went in to in researching how to code this. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Tuesday, October 28, 2014 10:13:14 PM UTC-7, Gregory Ewing wrote: No, that's not the correct answer. Being NP-complete doesn't mean something is impossible, or even hard to do. All it means is that nobody knows of a cleverer solution than just trying all possibilities. That's only a difficulty if the problem is large enough; often it won't be. Why do you need to iterate over all possibilities solving this problem anyway? -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Tuesday, October 28, 2014 12:25:13 AM UTC-4, Terry Reedy wrote: On 10/27/2014 11:10 AM, emmanuel...@gmail.com wrote: THIS IS THE LIST OF BOY NAMES Jacob ... Writing hundreds of unnecessary lines at minimum inconsiderate. Please don't do it. -- Terry Jan Reedy The python programming community is BY FAR the best I've been in touch with. Asking for help with some code that is not working is OK here, but asking to have the homework done is disgusting. Just try mentioning the word homework on c++ or javascrip groups: They'll bully you to death! -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
This is a sample code on how to read data from a file files1 {} result = open(file1.txt) for line in result: file1 = linesplit() files1.append(file1) result.close() file1.sort() file1.reverse() print('THE FILE INFO') print(file1(0) print(file1(1) -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On 28Oct2014 09:07, ngangsia akumbo ngang...@gmail.com wrote: This is a sample code on how to read data from a file files1 {} result = open(file1.txt) for line in result: file1 = linesplit() files1.append(file1) result.close() file1.sort() file1.reverse() print('THE FILE INFO') print(file1(0) print(file1(1) Do you have a specific question to accompany this? The code above is syntactly invalid, so it will not run. The line: files1 {} is invalid, but looks like it is intended to initialise files1 as a dictionary. However, the rest of the program seems to use it as though it were a list. The line: file1 = linesplit() should probably be written: file1 = line.split() With it is legal (as it performs a comparison) but will fail because there's no bare split() function, and anyway is probably not as intended. Your final print statements need an extra closing parenthesis each. Cheers, Cameron Simpson c...@zip.com.au I fit in my suit, my suit fits in my suitcase, hence i fit in my suitcase. - Cees Keyer c...@htsa.hva.nl -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Monday, October 27, 2014 5:33:17 PM UTC-7, alex23 wrote: On 28/10/2014 1:10 AM, e...@gmail.com wrote: Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. This is actually a trick question. This is a classic unsolvable problem in computer science, known as the Dual Baskets problem. It is NP-complete, meaning that there is no easy solution. It requires brute-forcing and can take an indefinite period of time to complete, if at all. The correct answer is Not possible. Can you elaborate why it is an NP-complete problem or maybe a link to description of problem you are referring to? Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On 29/10/2014 11:28 AM, Anton wrote: Can you elaborate why it is an NP-complete problem or maybe a link to description of problem you are referring to? While not the exact problem, it's tangentially related to: http://kenlevine.blogspot.com.au/2011/03/reducing-humor-to-equation.html -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
Cameron Simpson c...@zip.com.au Wrote in message: On 28Oct2014 09:07, ngangsia akumbo ngang...@gmail.com wrote: This is a sample code on how to read data from a file files1 {} result = open(file1.txt) for line in result: file1 = linesplit() files1.append(file1) result.close() file1.sort() file1.reverse() print('THE FILE INFO') print(file1(0) print(file1(1) Do you have a specific question to accompany this? The code above is syntactly invalid, so it will not run. Your final print statements need an extra closing parenthesis each. Other comments - The line that appends probably wants to be in the loop, and is not. Is there a reason you're subsequently processing only the last line? -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Monday, October 27, 2014 5:33:17 PM UTC-7, alex23 wrote: It is NP-complete, meaning that there is no easy solution. The correct answer is Not possible. No, that's not the correct answer. Being NP-complete doesn't mean something is impossible, or even hard to do. All it means is that nobody knows of a cleverer solution than just trying all possibilities. That's only a difficulty if the problem is large enough; often it won't be. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Anyone know the solution
Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. THIS IS THE LIST OF BOY NAMES 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 IS THE LIST OF GIRLS NAME 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 -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Mon, 27 Oct 2014 08:10:04 -0700, emmanueloje wrote: Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. Your tutor for a start I think I could probably get one working in an hour or so without too much difficulty. What do you have? we do not do homework for you here. if you have some code that doesn't work as expected we may assist -- semper en excretus -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
2014-10-27 11:10 GMT-04:00 emmanuel...@gmail.com: Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. THIS IS THE LIST OF BOY NAMES 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 IS THE LIST OF GIRLS NAME 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 -- https://mail.python.org/mailman/listinfo/python-list The answer to you question is Yes. -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Mon, 27 Oct 2014 08:10:04 -0700, emmanueloje wrote: Write a program that reads the contents of the two files into two separate lists. Yep, know how to do that The user should be able to enter a boy's name, a girl's name or both Yep, know how to do that and the application will display messages indicating whether the names were among the most popular. Nope, not sure how to do that, please define the algorithm for determining a most popular name Determining if the name is in either of the lists is easy, know how to do that, but I'm not sure from your problem description if that's your definition of a most popular name or not. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On 28/10/2014 1:10 AM, emmanuel...@gmail.com wrote: Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. This is actually a trick question. This is a classic unsolvable problem in computer science, known as the Dual Baskets problem. It is NP-complete, meaning that there is no easy solution. It requires brute-forcing and can take an indefinite period of time to complete, if at all. The correct answer is Not possible. -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On 10/27/2014 11:10 AM, emmanuel...@gmail.com wrote: THIS IS THE LIST OF BOY NAMES Jacob ... Writing hundreds of unnecessary lines at minimum inconsiderate. Please don't do it. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list