Level 05: one-dimension arrays and lists 0 of 9 activities solved
  1. 1. RPG inventory Not yet solved
  2. 2. Search for life Not yet solved
  3. 3. Two-dice pig Not yet solved
  4. 4. Random name generator Not yet solved
  5. 5. Cup draw Not yet solved
  6. 6. Feud Not yet solved
  7. 7. Darts Not yet solved
  8. 8. Cut the deck Not yet solved
  9. 9. London underground Not yet solved
Next series Level 06: count controlled iterations and scope
Level 05: one-dimension arrays and lists

2. Search for life

Sign in to hand in your solution and get feedback.

# Search for life program # ------------------------- # Import libraries # ------------------------- import random # ------------------------- # Subprograms # ------------------------- def probe(planet): creature = ["lizards", "humanoids", "insects"] colour = ["red", "green", "blue"] characteristic = ["shy", "angry", "docile"] random.seed(planet) lifeform = random.randint(0,2) specimen = random.randint(0,2) behaviour = random.randint(0,2) report = "" report = colour[specimen] report = report + ", " + characteristic[behaviour] report = report + " " + creature[lifeform] report = report + " on the planet." return report # ------------------------- # Main program # ------------------------- planet = int(input("Enter the catalogue number of a planet: ")) report = probe(planet) print("Probes report", report)