Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python code Question-1: Take two lists from the user (elements of the lists separated by space) of the same size. The first list will contain

python code

Question-1: Take two lists from the user (elements of the lists separated by space) of the same size. The first list will contain some names and the second list will contain roll numbers. Your job is to assign each name a roll number from the list containing numbers following the criteria given below: Find the sum of the ASCII value of each name and then sort the names in descending order based on the sum. Then assign the lowest number to the name that has the highest ASCII value sum as a roll number. ================================================ Sample Input 1: Alan Jack Nancy Jim 10 15 20 50 Sample Output 1: Nancy's roll number is: 10 Alan's roll number is: 15 Jack's roll number is: 20 Jim's roll number is: 50 Explanation1: Here, the summation of the ASCII value of each name are: Nancy(505), Alan(380), Jack(377) and Jim(288). So, Nancy got the lowest number (10) from the number list as roll number, then Alan got the second lowest (15), followed by Jack(20) and Jim (50). ================================================ Sample Input 2: Leo Tim Kim Brad Joey 55 15 25 19 12 Sample Output 2: Joey's roll number is: 12 Brad's roll number is: 15 Tim's roll number is: 19 Kim's roll number is: 25 Leo's roll number is: 55 Explanation2: Here, the summation of the ASCII value of each name are: Joey(407), Brad(377), Tim(298), Kim(289) and Leo(288). So, Joey got the lowest number (12) from the number list as roll number, then Brad got the second lowest (15), followed by Tim(19), Kim(25) and Leo(55).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

Solve for x: 2(3x 1)2(x + 5) = 12

Answered: 1 week ago