k = 130 m = 7655 if k > 42: print 'Hi' elif m > 43: print 'Hello' else: print 'Bye'
======================== RESTART: C:/Python27/test.py ======================== Hi >>>
import numpy n = numpy.zeros(5) n[0] = 20. n[4] = 99. print n print n[-1]
import numpy p = numpy.zeros([2, 3]) p[0, 1] = 7. p[1, 2] = 8. print p p = 1. + 2. * p print p
def three_times(u): r = 2 * u return r + u print three_times(1), three_times(7)
======================== RESTART: C:/Python27/test.py ======================== 3 21 >>>
import math from xxx import * def sin_cos(): num_points = 50 x = numpy.zeros(num_points) sin_x = numpy.zeros(num_points) cos_x = numpy.zeros(num_points) for i in range(num_points): x[i] = 2. * math.pi * i / (num_points - 1.) sin_x[i] = math.sin(x[i]) cos_x[i] = math.cos(x[i]) return x, sin_x, cos_x x, sin_x, cos_x = sin_cos() @show_plot def plot_me(): matplotlib_pyplot.plot(x, sin_x) matplotlib_pyplot.plot(x, cos_x) plot_me()