Apr-22-2017, 04:41 PM
my question here
I have an assignment where I am having an issue. I am to generate random numbers from 10 - 99. Then take an array list of first and last name and display the Unique ID first and last name in descending order.
ex: 18 Anna Zenoff
12 Annamma Shultz
2 Debby Rahman
should display:
2 Debby Rahman
12 Annamma Shultz
18 Anna Zenoff
I am not sure how to merge the two into one list display just first and last name
any help will be gladly appreciated.
I have an assignment where I am having an issue. I am to generate random numbers from 10 - 99. Then take an array list of first and last name and display the Unique ID first and last name in descending order.
ex: 18 Anna Zenoff
12 Annamma Shultz
2 Debby Rahman
should display:
2 Debby Rahman
12 Annamma Shultz
18 Anna Zenoff
I am not sure how to merge the two into one list display just first and last name
any help will be gladly appreciated.
firstName=['Anna','Annamma','Debby','Jim','Kenneth','Lusan','Maggie','Manny','Michael','Norma','Paige','Patti','Teresa','Tobi','Tom','Val'] lastName=['Zenoff','Shultz','Rahman','Hooper','Black','Zenoff','Perdue','Ryan','Franco','Ayala','Braun','Rahman','Kuawata','Bombino','Ulch','Umeda'] # Input: get values listSize = len(firstName) numberId = [0] * listSize min2max = [0] * listSize mergedList= [0] * listSize # generate list of unique, random IDs for index in range(listSize): numberId[index] = random.randint(10,99) # Processing: carry out calculations for index in range(listSize): min2max[index] = numberId[index] count = listSize flag = 0 while flag == 0: flag = 1 k = 0 while k<=(count - 2): if min2max[k] > min2max[k+1]: temp = min2max[k] min2max[k] = min2max[k+1] min2max[k+1] = temp flag = 0 k = k + 1 print(min2max[index] #only prints one random number doesn't display 16 of them