Wie erstelle ich Testfälle in Polygon für das Python -Programm mit zufälligen Werten?Python

Python-Programme
Anonymous
 Wie erstelle ich Testfälle in Polygon für das Python -Programm mit zufälligen Werten?

Post by Anonymous »

Ich habe ein Anfänger -Python -Programm, das zufällige Ausgabe erzeugt und keine Eingabe nimmt. Zum Beispiel simuliert es das Rollen eines Würfels 5 Mal und druckt die Ergebnisse, deren Summe und Durchschnitt: < /p>

Code: Select all

import random

total = 0
rolls = ""

for i in range(5):
roll = random.randint(1, 6)
rolls += str(roll) + " "

print(rolls)
print(total)
print(total / 5)
Wie kann ich in Polygon gültige Testfälle für ein Python -Programm erstellen, das:
Eingabetaste nicht lesen
erzeugt zufällige Ausgabe
… ohne die Änderung des Thecode?>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post