Latest web development tutorials

Python obejmuje ćwiczenia 72

Python 100 Li Python 100 Li

Temat: Tworzenie połączonej listy.

Program Analysis: Brak.

Kod źródłowy:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

if __name__ == '__main__':
    ptr = []
    for i in range(5):
        num = int(raw_input('please input a number:\n'))
        ptr.append(num)
    print ptr

Powyższy przykład wyjście jest:

please input a number:
3
please input a number:
5
please input a number:
7
please input a number:
8
please input a number:
2
[3, 5, 7, 8, 2]

Python 100 Li Python 100 Li