Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

can anybody who knows c++ help me with this?

Name: Anonymous 2011-03-07 22:03

Write a program that initializes an array with ten random integers and then prints four lines of output containing:
-every element at an even index
-every even element
-all elements in reverse order
-only the first and last element.

Name: Anonymous 2011-03-07 22:12

Sure.

import random
xs = [random.randint(1, 100) for i in xrange(10)]
print xs[::2]
print [x for x in xs if x % 2 == 0]
print xs[::-1]
print xs[0], xs[-1]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List