SHARE
TWEET

hw2

a guest Jun 24th, 2019 60 in 6 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # find the largest number in the array below and the second
  2. # largest number in the array and then print out:
  3. #    "The largest number is: <insert the largest number>"
  4. #    "The second largest number is: <insert the second largest number>"
  5. # you may not use the python max function, that's cheating.....sluts
  6. # hints:
  7. #    -you will need to loop over the array
  8. #    -you need to keep track of the current biggest number and the current second biggest
  9. #    -you will know the current second biggest number when the current biggest number is located
  10. #    -knowing what "compare and swap" is will help
  11. a_someNumbers = [128,3,8,298,12,13,15,200,201,202,500,501,90,400,300,399]
  12.  
  13.  
  14. #code can go here
  15.  
  16.  
  17. # find the oldest person in the array and then print out:
  18. # "<name> is the oldest person in the group at <age> years old"
  19. # hints:
  20. #   -you will need to loop over the array
  21. #   -you will need to keep track of who the current oldest is
  22. #   -you will need to remember their name as well
  23. a_somePeople = [
  24.     {
  25.         "name": "Han",
  26.         "info": {
  27.             "age": 30
  28.         }
  29.     },
  30.     {
  31.         "name": "Luke",
  32.         "info": {
  33.             "age": 12
  34.         }
  35.     },
  36.     {
  37.         "name": "Vader",
  38.         "info": {
  39.             "age": 9001
  40.         }
  41.     }
  42. ]
  43.  
  44.  
  45. #more code can go here
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top