Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Time to get started on Python homework...
#2
import random

Then look up its documentations for RNG features.
Depending on the specific requirements (numbers repeating, non-repeating adjacents, such and such...), figure out an appropriate way to do it. By data structures, I assume your teacher/whoever wants you to use arrays and/or lists, which are what I'd use if the numbers don't repeat themselves.
As for printing everything out in one line, I *think* an efficient way is to concatenate the sub-results into a final string to be output. If I'm not mistaken, concatenating string in Python involves only a + operator.
Reply


Messages In This Thread
Time to get started on Python homework... - by Kalovale - 2011-10-06, 02:07 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)