int[] numbers = {9,8,7,6,5,4,3,2,1} ;
int min = numbers[0];
for ( int n : numbers ) {
min = min < n ? min : n;
}
System.out.println("Min = " + min);int[] numbers = {9,8,7,6,5,4,3,2,1} ;
Arrays.sort(numbers);
int min = numbers[0];
System.out.println("Min = " + min); import requests
filename='test_file'
f = open (filename)
r = requests.post(url='http://upload.example.com', data = {'title':'test_file}, files = {'file':f})
print r.status_code
print r.headersimport threading
from random import randint
from time import sleep
def printNumber(number):
# Sleeps a random 1 to 10 seconds
sleep(randint(1,10))
print str(number)
thread_list = []
for i in range(1,10):
# Instatiates the thread
# (i) does not make a sequence, so (i,)
t = threading.Thread(target=printNumber, args=(i,))
# Sticks the thread in a list so that it remains accessible
thread_list.append(t)
# Starts threads
for thread in thread_list:
thread.start()
# This blocks the calling thread until the thread whose join() method is called is terminated.
# From http://docs.python.org/2/library/threading.html#thread-objects
for thread in thread_list:
thread.join()
# Demonstrates that the main process waited for threads to complete
print "Done"