{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1 5 2 6\n", "1 5 3 7\n", "1 5 4 8\n" ] } ], "source": [ "j = [1, 2, 3, 4]\n", "k = [5, 6, 7, 8]\n", "z = zip(j, k)\n", "for x, y in z:\n", " for m, n in z:\n", " print (x, y, m, n)\n", "# the resuls in python 3.6" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(1, 5, 1, 5)\n", "(1, 5, 2, 6)\n", "(1, 5, 3, 7)\n", "(1, 5, 4, 8)\n", "(2, 6, 1, 5)\n", "(2, 6, 2, 6)\n", "(2, 6, 3, 7)\n", "(2, 6, 4, 8)\n", "(3, 7, 1, 5)\n", "(3, 7, 2, 6)\n", "(3, 7, 3, 7)\n", "(3, 7, 4, 8)\n", "(4, 8, 1, 5)\n", "(4, 8, 2, 6)\n", "(4, 8, 3, 7)\n", "(4, 8, 4, 8)\n" ] } ], "source": [ "p = [1, 2, 3, 4]\n", "q = [5, 6, 7, 8]\n", "z = zip(p, q)\n", "for x, y in z:\n", " for m, n in z:\n", " print (x, y, m, n)\n", "# the resuls in python 2.7" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 2 }