Problem Solving
Houston, we have a problem
Problem: Get home Given: Oxygen scrubbers don’t fit Goal: Make them fit! Resources: Duct Tape! Expertise Constraints Time Vast emptiness of space Ownership Team of engineers at mission control
Problem solving strategies Get the Astronauts Home Fix Oxygen Problem Get back to Earth Get home Stop Oxygen Leak Fix up temporary engine Dump other modules Adapt CO2 Scrubbers Turn Spaceship Around Re-enter atmosphere Get back to Earth Orbit “Top Down”
Problem solving strategies Get the Astronauts Home Stop Oxygen Leak Fix up temporary engine Turn Spaceship Around Get back to Earth Orbit Adapt CO2 Scrubbers Dump other modules Re-enter atmosphere “Stepwise refinement”
Input This will work: result = input(“What should I do?:”) print “You told me to “,result But only if the input is a number, otherwise it gives an error. Why? How to fix it?
A basic menu def ShowMenu(): print “”” Please choose an option: 1 – Square 2 – Hexagon 3 – Octagon 4 – Quit --------------------------- “”” def GetResponse(): response = input(“Enter Option Number:”) return response