Die Wiederholung einer Funktion eine festgelegte Anzahl von Zeiten in python

Mache ich ein intro Klasse und Sie bitten mich zu wiederholen-Funktion eine bestimmte Anzahl von Zeiten, wie ich sagte, es ist ein intro, so dass die meisten der code geschrieben ist, so übernehmen die Funktionen definiert wurden. Ich habe zu wiederholen, die tryConfiguration(floorplan,numLights) die Zeit numTries Anfragen. jede Hilfe wäre genial 😀 danke.

def runProgram():
  #Allow the user to open a floorplan picture (Assume the user will select a valid PNG floodplan)
  myPlan = pickAFile()
  floorplan = makePicture(myPlan)
  show(floorplan)

  #Display the floorplan picture

  #In level 2, set the numLights value to 2
  #In level 3, obtain a value for numLights from the user (see spec).
  numLights= requestInteger("How many lights would you like to use?")

  #In level 2, set the numTries to 10
  #In level 3, obtain a value for numTries from the user.
  numTries= requestInteger("How many times would you like to try?")

  tryConfiguration(floorplan,numLights)

  #Call and repeat the tryConfiguration() function numTries times. You will need to give it (pass as arguments or parameterS)
  #   the floorplan picture that the user provided and the value of the numLights variable.
  • Verwenden Sie eine for Schleife.
  • Wir sind glücklich, Ihnen zu helfen, mit diesen Problemen auf StackOverflow, poste doch bitte, was du bisher ausprobiert habe.
InformationsquelleAutor user3804780 | 2014-07-04
Schreibe einen Kommentar