0 like 0 dislike
295 views
import random

num_list = random.sample(range(1, 101), 10)

print('原始的10個數字為:')

$1

num1 = num_list.copy()

num1.reverse()

print('\n\n反向的10個數字為:')

for i in num1:

    print(i, end = ' ')

print('\n\n最大的數:', max(num_list))

print('最小的數:', min(num_list))

print('\n總和:', sum(num_list))

print('平均:', sum(num_list) / len(num_list))

num1.sort(reverse = True)

print('數字從大到小排列:', end = '')

for i in num1:

    print(i, end = ' ')

num_list.insert(2, 100)

del num_list[-1]

print('\n修改後的串列:', end = '')

for i in num_list:

    print(i, end = ' ')
[Exercise] Fill in the blank - asked in 作業 by (937 points)
ID: 107325 - Available when: Unlimited - Due to: Unlimited
| 295 views
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.117
©2016-2024

No related questions found

12,783 questions
183,443 answers
172,219 comments
4,824 users