Write a program that takes a user-input number and then determines which number in theList is closest to the user-input number. theList = ["846", "757", "383", "988", "347", "136", "616", "385", "742", "646", "755", "936", "612", "690", "255", "278", "285", "199", "408", "613", "337", "568", "284", "848", "411", "384", "423", "721", "567", "339", "162", "489", "637", "358", "992", "571", "365", "361", "341", "756", "255", "547", "493", "807", "181", "921", "480", "549", "415", "904", "713", "195", "309", "612", "231", "104", "142", "229", "570", "921", "234", "796", "727", "767", "439", "525", "588", "934", "631", "708", "447", "833", "373", "654", "719", "970", "698", "865", "943", "330", "154", "732", "716", "273", "116", "957", "713", "593", "825", "618", "436", "803", "203", "948", "508", "305", "473", "128", "495", "620", "865", "878", "682", "443", "693", "518", "757", "563", "437", "122", "588", "782", "452", "171", "847", "141", "310", "502", "339", "166", "360", "599", "174", "477", "325", "128", "882", "536", "790", "684", "928", "252", "436", "437", "108", "817", "969", "105", "776", "137", "968", "983", "952", "973", "835", "295", "726", "589", "644", "413", "102", "308", "471", "322", "371", "235", "616", "706", "532", "455", "601", "784", "224", "523", "773", "653", "403", "491", "625", "229", "581", "779", "122", "583", "567", "636", "585", "338", "797", "469", "305", "741", "569", "891", "992", "600", "993", "535", "392", "726", "603", "854", "845", "473", "287", "705", "846", "543", "336", "874", "941", "376", "164", "921", "743", "938", "399", "248", "513", "372", "410", "614", "685", "899", "146", "253", "944", "985", "950", "395", "931", "841", "430", "248", "234", "745", "846", "270", "852", "151", "576", "406", "794", "494", "307", "195", "291", "763", "132", "328", "124", "318", "935", "580", "226", "941", "851", "251", "796", "892"]
Write a program that takes a user-input number and then determines which number in theList is closest to the user-input number.
theList = ["846", "757", "383", "988", "347", "136", "616", "385", "742", "646", "755", "936", "612", "690", "255", "278", "285", "199", "408", "613", "337", "568", "284", "848", "411", "384", "423", "721", "567", "339", "162", "489", "637", "358", "992", "571", "365", "361", "341", "756", "255", "547", "493", "807", "181", "921", "480", "549", "415", "904", "713", "195", "309", "612", "231", "104", "142", "229", "570", "921", "234", "796", "727", "767", "439", "525", "588", "934", "631", "708", "447", "833", "373", "654", "719", "970", "698", "865", "943", "330", "154", "732", "716", "273", "116", "957", "713", "593", "825", "618", "436", "803", "203", "948", "508", "305", "473", "128", "495", "620", "865", "878", "682", "443", "693", "518", "757", "563", "437", "122", "588", "782", "452", "171", "847", "141", "310", "502", "339", "166", "360", "599", "174", "477", "325", "128", "882", "536", "790", "684", "928", "252", "436", "437", "108", "817", "969", "105", "776", "137", "968", "983", "952", "973", "835", "295", "726", "589", "644", "413", "102", "308", "471", "322", "371", "235", "616", "706", "532", "455", "601", "784", "224", "523", "773", "653", "403", "491", "625", "229", "581", "779", "122", "583", "567", "636", "585", "338", "797", "469", "305", "741", "569", "891", "992", "600", "993", "535", "392", "726", "603", "854", "845", "473", "287", "705", "846", "543", "336", "874", "941", "376", "164", "921", "743", "938", "399", "248", "513", "372", "410", "614", "685", "899", "146", "253", "944", "985", "950", "395", "931", "841", "430", "248", "234", "745", "846", "270", "852", "151", "576", "406", "794", "494", "307", "195", "291", "763", "132", "328", "124", "318", "935", "580", "226", "941", "851", "251", "796", "892"]

The problem is based on the basics of dictionary and lists in python programming language.
Step by step
Solved in 4 steps with 2 images









