Home > other >  How python statistics random output result
How python statistics random output result

Time:10-07

I think the statistics' noodle 'and' ravioli ', 'eggs Fried rice', 'chicken', 'dumplings' the number of occurrences of number, how to write the code
In addition the following code to cycle through model simplification,
If new five individuals, according to the current model to a person with two lines of code, five plus ten lines of code,
Can add the names to the list, the use of loop automatic output


The code
Import the random
Cc=[' noodles, wonton, Fried rice with egg, 'chicken', 'dumplings]
X1=the random choice (cc)
X2=the random choice (cc)
The x3=the random choice (cc)
X4=the random choice (cc)
X5=the random choice (cc)
X6=the random choice (cc)
X7=the random choice (cc)
By 8=the random choice (cc)
X9.=the random choice (cc)
Print (' xiaoming suggestion + x1)
Print (' wang suggestion + x2)
Print (' xiao li's advice '+ x3)
Print (' xiao wu suggestion + x4)
Print (' Chou suggestion + x 5)
Print (' han provided suggestion + x6)
Print (' small four suggestion + x7)
Print (' recommendations' picture + by 8)
Print (' pony suggestion + x9)

CodePudding user response:

The basic cycle, suggest to find a book to see,
  • Related