{"id":28891,"date":"2023-01-04T06:02:16","date_gmt":"2023-01-04T00:32:16","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/"},"modified":"2023-01-04T06:02:16","modified_gmt":"2023-01-04T00:32:16","slug":"solved-python-using-nested-lists-list-of-lists-from-user-input-closed","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/","title":{"rendered":"[Solved] Python, using nested lists (list of lists) from user input [closed]"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-68077280\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"68077280\" data-parentid=\"68075403\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>So if I&#8217;m understanding correctly, the &#8220;Lists of List&#8221; comment pertains to nested Lists, The code you have is close to what&#8217;s needed.<br \/>\nI believe this is what you need.<\/p>\n<pre><code>print(\"Enter First name, last name and Student ID number. Then press 0 to continue\")\n\nuserFirst = str(input(\"Enter First Here:\"))\nuserLast = str(input(\"Enter Last Name:\"))\nuserStudent = int(input(\"Enter Student ID number:\"))\nuserInfo = input(\"Enter more details or pres 0 to enter search mode\")\n\nwhile userInfo != \"0\":\n    userInfo=input(\"Enter more details\")\nelse:\n        print(\"Search Mode\")\n\n###Changed SearchMode to be nested list with each list Holding the input values from [ [UserFirst],[userLast],[userStuden] ]\nsearchMode = [[],[],[]]\n    ### Append userFirst to the first Indexed List\nsearchMode[0].append(userFirst)\n    ### Append userLast to the second Indexed List\nsearchMode[1].append(userLast)\n    ### Append userStudent to the third Indexed List\nsearchMode[2].append(userStudent)\n\nuserSearch = int(input(\"Enter Student ID\"))\n\n### Since we know that we need to search by The Student Id we Take the InitialList and add the index of our desired Nested List; In this Case it's the 3rd nested\n### Then we take the values from the nested List and look for the inputted value and obtain the record corresponding index\nuserSearch = searchMode[2][userStudent-1]\nprint(userSearch)\n<\/code><\/pre>\n<p>Let me know if this doesn&#8217;t give you the results you need and I&#8217;ll try working on it some more<\/p>\n<p>update:<br \/>\nFor the fun of it, I recreated the process to be called as a function.<\/p>\n<pre><code>def SearchRequest():\n    ### This Will Hold our Input Data\n    SearchData = [[],[],[],[]]\n\n    ### This Will Run The Question Prompts We Want Filled\n    def promptQuestions():\n\n        # Get User First Name\n        def userFirst():\n            return SearchData[0].append(str(input('Enter First Name Here: ')))\n\n        # Get User Last Name\n        def userLast():\n            return SearchData[1].append(str(input('Enter Last Name Here: ')))\n        # Get User Student ID\n        def userStudent():\n            return SearchData[2].append(int(input('Enter Student ID Number: ')))\n\n        # Ask If They Want to Add Additional Info; Entering 0 Will Exit The Asking Phase\n        # Once Completed We Will Start the UserId Lookup Phase\n        def userInfo():\n            #Beginning Prompt\n            userInfo = input('Enter More Details Or Press 0 to Enter Search Mode')\n            #List We'll Be Using To Hold Inputs\n            output = []\n            #Append First input To our Output List\n            output.append(userInfo)\n\n            while userInfo != \"0\":\n                #If 0 Was Not Entered: Ask To Enter More Details\n                userInfo=input('Enter More Details: ')\n                #Append Details To Our Output List\n                output.append(userInfo)\n            else:\n                print('Entering Search Mode')\n                #Append Result List To Our Main Search Data\n                SearchData[3].append(output)\n\n        # Ending Of Prompt Questions\n        def runQuestions():\n            \"\"\"This will be used to hold the order of execution\"\"\"\n            userFirst()\n            userLast()\n            userStudent()\n            userInfo()\n            return SearchData\n        return runQuestions()\n\n        #Create a Search Mode Allowing User To Lookup ID\n    def SearchMode():\n            #Gets Input ID to LookUP\n        def SearchStudentID():\n            return int(input('Enter Student ID: '))\n        #Returns the matching ID as long as the ID is the same as the index Number\n        return SearchData[2][SearchStudentID()-1]\n\n\n    # Final Layer to Our Searching Process\n    def runSearchProcess():\n\n        #Begins Main Prompt Phase\n        promptQuestions()\n\n        #Once Everything is completed, Return the search Modes Result\n        return SearchMode()\n    #Ending Of Search Request\n    return runSearchProcess()\n\n\nprint(SearchRequest())\n<\/code><\/pre>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">3<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Python, using nested lists (list of lists) from user input [closed] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] So if I&#8217;m understanding correctly, the &#8220;Lists of List&#8221; comment pertains to nested Lists, The code you have is close to what&#8217;s needed. I believe this is what you need. print(&#8220;Enter First name, last name and Student ID number. Then press 0 to continue&#8221;) userFirst = str(input(&#8220;Enter First Here:&#8221;)) userLast = str(input(&#8220;Enter Last Name:&#8221;)) &#8230; <a title=\"[Solved] Python, using nested lists (list of lists) from user input [closed]\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/\" aria-label=\"More on [Solved] Python, using nested lists (list of lists) from user input [closed]\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[349],"class_list":["post-28891","post","type-post","status-publish","format-standard","hentry","category-solved","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] Python, using nested lists (list of lists) from user input [closed] - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] Python, using nested lists (list of lists) from user input [closed] - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] So if I&#8217;m understanding correctly, the &#8220;Lists of List&#8221; comment pertains to nested Lists, The code you have is close to what&#8217;s needed. I believe this is what you need. print(&quot;Enter First name, last name and Student ID number. Then press 0 to continue&quot;) userFirst = str(input(&quot;Enter First Here:&quot;)) userLast = str(input(&quot;Enter Last Name:&quot;)) ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-04T00:32:16+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] Python, using nested lists (list of lists) from user input [closed]\",\"datePublished\":\"2023-01-04T00:32:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/\"},\"wordCount\":96,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"python\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/\",\"name\":\"[Solved] Python, using nested lists (list of lists) from user input [closed] - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2023-01-04T00:32:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] Python, using nested lists (list of lists) from user input [closed]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] Python, using nested lists (list of lists) from user input [closed] - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] Python, using nested lists (list of lists) from user input [closed] - JassWeb","og_description":"[ad_1] So if I&#8217;m understanding correctly, the &#8220;Lists of List&#8221; comment pertains to nested Lists, The code you have is close to what&#8217;s needed. I believe this is what you need. print(\"Enter First name, last name and Student ID number. Then press 0 to continue\") userFirst = str(input(\"Enter First Here:\")) userLast = str(input(\"Enter Last Name:\")) ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/","og_site_name":"JassWeb","article_published_time":"2023-01-04T00:32:16+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] Python, using nested lists (list of lists) from user input [closed]","datePublished":"2023-01-04T00:32:16+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/"},"wordCount":96,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["python"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/","url":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/","name":"[Solved] Python, using nested lists (list of lists) from user input [closed] - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2023-01-04T00:32:16+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-python-using-nested-lists-list-of-lists-from-user-input-closed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] Python, using nested lists (list of lists) from user input [closed]"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/28891","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=28891"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/28891\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=28891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=28891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=28891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}