首页 > 编程语言 >实验3 控制语句与组合数据类型应用编程

实验3 控制语句与组合数据类型应用编程

时间:2023-04-23 21:56:19浏览次数:41  
标签:语句 count product 编程 数据类型 cart products print id

task1

源代码

 1 import random
 2 
 3 print('用列表存储随机整数:')
 4 lst = [random.randint(0, 100) for i in range(5)]
 5 print(lst)
 6 
 7 print('\n用集合存储随机整数:')
 8 s1 = {random.randint(0, 100) for i in range(5)}
 9 print(s1)
10 
11 print('\n用集合存储随机整数:')
12 s2 = set()
13 while len(s2) < 5:
14     s2.add(random.randint(0, 100))
15 print(s2)

运行截图:

答1:[0, 100]闭区间,可取到100

答2:0-4,不包括5;1-4,不包括5

答3:不一定,若出现重复数字,集合只储存一次

答4:是的

 

task2_1

源代码:

 1 # 列表遍历
 2 lst = [55, 92, 88, 79, 96]
 3 
 4 # 遍历方式1:使用while + 索引
 5 i = 0
 6 while i < len(lst):
 7     print(lst[i], end=' ')
 8     i += 1
 9 
10 print()
11 
12 # 遍历方式2:使用for + 索引
13 for i in range(len(lst)):
14     print(lst[i], end=' ')
15 print()
16 
17 # 遍历方式3:使用for ... in
18 for i in lst:
19     print(i, end=' ')
20 print()

运行截图:

task2_2

源代码:

 1 # 字典遍历
 2 book_info = {'isbn': '978-7-5356-8297-0',
 3              '书名': '白鲸记',
 4              '作者': '克里斯多夫.夏布特',
 5              '译者': '高文婧',
 6              '出版社': '湖南美术出版社',
 7              '售价': 82}
 8 
 9 # 遍历key-value对:实现方式1
10 for key, value in book_info.items():
11     print(f'{key}: {value}')
12 print()
13 
14 # 遍历key-value对:实现方式2
15 for item in book_info.items():
16     print(f'{item[0]}: {item[1]}')
17 print()
18 
19 # 遍历值:实现方式1
20 for value in book_info.values():
21     print(value, end=' ')
22 print()
23 
24 # 遍历值:实现方式2
25 for key in book_info.keys():
26     print(book_info[key], end=' ')

运行截图:

task2_3

源代码:

 1 book_infos = [{'书名': '昨日的世界', '作者': '斯蒂芬.茨威格'},
 2               {'书名': '局外人', '作者': '阿尔贝.加缪'},
 3               {'书名': '设计中的设计', '作者': '原研哉'},
 4               {'书名': '万历十五年', '作者': '黄仁宇'},
 5               {'书名': '刀锋', '作者': '毛姆'}]
 6 
 7 for i in range(len(book_infos)):
 8     lst = []
 9     for value in book_infos[i].values():
10         lst.append(value)
11     print(f'{i + 1}.', '《'+lst[0]+'》'+',' + lst[1])

运行截图:

task3

源代码:

 1 text = '''Beautiful is better than ugly.
 2 Explicit is better than implicit.
 3 Simple is better than complex.
 4 Complex is better than complicated.
 5 Flat is better than nested.
 6 Sparse is better than dense.
 7 Readability counts.
 8 Special cases aren't special enough to break the rules.
 9 Although practicality beats purity.
10 Errors should never pass silently.
11 Unless explicitly silenced.
12 In the face of ambiguity, refuse the temptation to guess.
13 There should be one-- and preferably only one --obvious way to do it.
14 Although that way may not be obvious at first unless you're Dutch.
15 Now is better than never.
16 Although never is often better than *right* now.
17 If the implementation is hard to explain, it's a bad idea.
18 If the implementation is easy to explain, it may be a good idea.
19 Namespaces are one honking great idea -- let's do more of those!'''
20 
21 text1 = text.lower()
22 dict = {}
23 for i in range(97, 123):
24     if chr(i) in text1:
25         num = text1.count(chr(i))
26         dict.setdefault(chr(i), num)
27     else:
28         dict.setdefault(chr(i), 0)
29 sorted_values = sorted(dict.values(), reverse=True)
30 sorted_dict = {}
31 for i in sorted_values:
32      for k in dict.keys():
33          if dict[k] == i:
34              sorted_dict[k] = dict[k]
35 for i in range(len(sorted_values)):
36     print(f'{list(sorted_dict.keys())[i]}:{list(sorted_dict.values())[i]}')

运行截图:

task4

源代码:

 1 code_majors = {'8326': '地信类',
 2                '8329': '计算机类',
 3                '8330': '气科类',
 4                '8336': '防灾工程',
 5                '8345': '海洋科学',
 6                '8382': '气象工程'}
 7 
 8 print(f'{"专业代号信息":-^50}')
 9 for key, value in code_majors.items():
10     print(f'{key}: {value}')
11 print(f'{"学生专业查询":-^50}')
12 while True:
13     num = input("请输入学号:")
14     if num == '#':
15         print('查询结束')
16         break
17     else:
18         if num[4:8] in code_majors.keys():
19             print(f'专业是:{code_majors[num[4:8]]}')
20         else:
21             print('不在这些专业中...')

运行截图:

task5

源代码:

 1 import random
 2 
 3 May_luckyday = random.randint(1, 31)
 4 
 5 print(f'猜猜2023年5月哪一天会是你的lucky day{chr(129392)}')
 6 day = int(input('你有三次机会,猜吧(1~31):'))
 7 for i in range(1, 4):
 8     if 1 <= day <= 31:
 9         if day == May_luckyday:
10             print(f'哇,猜中啦{chr(129395)}')
11             break
12         elif day <= May_luckyday:
13             print(f'猜早啦,你的 lucky day还没到呢{chr(129303)}')
14             if i != 3:
15                 day = int(input('再猜(1~31):'))
16             elif i == 3:
17                 print(f'哇哦,次数用光啦。{chr(128565)}')
18                 print(f'偷偷告诉你,5月你的lucky day是{May_luckyday}号.good luck{chr(9786)}')
19                 break
20         else:
21             print(f'猜晚啦,你的 lucky day过去了{chr(128547)}')
22             if i != 3:
23                 day = int(input('再猜(1~31):'))
24             elif i == 3:
25                 print(f'哇哦,次数用光啦。{chr(128547)}')
26                 print(f'偷偷告诉你,5月你的lucky day是{May_luckyday}号.good luck{chr(9786)}')
27                 break
28     elif day < 1 or day > 31:
29         print(f'地球上没有这一天啦,你是外星人吗{chr(128517)}')
30         if i != 3:
31             day = int(input('再猜(1~31):'))
32         elif i == 3:
33             print(f'哇哦,次数用光啦。{chr(128547)}')
34             print(f'偷偷告诉你,5月你的lucky day是{May_luckyday}号.good luck{chr(9786)}')
35             break

运行截图:

task6

源代码:

 1 datas = {'2049777001': ['篮球', '羽毛球', '美食', '漫画'],
 2          '2049777002': ['音乐', '旅行'],
 3          '2049777003': ['马拉松', '健身', '游戏'],
 4          '2049777004': [],
 5          '2049777005': ['足球', '阅读'],
 6          '2049777006': ['发呆', '闲逛'],
 7          '2049777007': [],
 8          '2049777008': ['书法', '电影'],
 9          '2049777009': ['音乐', '阅读', '电影', '漫画'],
10          '2049777010': ['数学', '推理', '音乐', '旅行']
11          }
12 lst = []
13 dict = {}
14 for i, value in enumerate(datas.values()):
15     lst += value
16 for i in range(len(lst)):
17     dict.setdefault(lst[i], ' '.join(lst).count(lst[i]))
18 sorted_values = sorted(dict.values(), reverse=True)
19 sorted_dict = {}
20 for i in sorted_values:
21      for k in dict.keys():
22          if dict[k] == i:
23              sorted_dict[k] = dict[k]
24 for i in range(len(sorted_values)):
25     print(f'{list(sorted_dict.keys())[i]}:{list(sorted_dict.values())[i]}')

运行截图:

task7_1

源代码:

"""
家用电器销售系统
v1.3
"""
# 欢迎信息
print('欢迎使用家用电器销售系统!')
# 商品数据初始化
products = [
    ['0001', '电视机', '海尔', 5999.00, 20],
    ['0002', '冰箱', '西门子', 6998.00, 15],
    ['0003', '洗衣机', '小天鹅', 1999.00, 10],
    ['0004', '空调', '格力', 3900.00, 0],
    ['0005', '热水器', '格力', 688.00, 30],
    ['0006', '笔记本', '联想', 5699.00, 10],
    ['0007', '微波炉', '苏泊尔', 480.00, 33],
    ['0008', '投影仪', '松下', 1250.00, 12],
    ['0009', '吸尘器', '飞利浦', 999.00, 9],
]


# 初始化用户购物车
products_cart = []

option = input('请选择您的操作:1-查看商品;2-购物;3—查看购物车;其他-结账')

while option in['1', '2', '3']:
    if option == '1':
        # 产品信息列表
        print('产品和价格信息如下:')
        print('************************************************')
        print('%-10s' % '编号', '%-10s' % '名称', '%-10s' % '品牌', '%-10s' % '价格', '%-10s' % '库存数量')
        print('-------------------------------------------------')
        for i in range(len(products)):
            print('%-10s' % products[i][0], '%-10s' % products[i][1], '%-10s' % products[i][2], '%10.2f' % products[i][3], '%10d' % products[i][4])
        print('-------------------------------------------------')
    elif option == '2':
        product_id = input('请输入您要购买的产品编号:')
        while product_id not in [item[0] for item in products]:
            product_id = input('编号不存在,请重新输入您要购买的产品编号:')

        count = int(input('请输入您要购买的产品数量:'))
        while count > products[int(product_id)-1][4]:
            count = int(input('数量超出库存,请重新输入您要购买的产品数量:'))
        # 将所购买的商品加入购物车
        if product_id not in [item[0] for item in products_cart]:
            products_cart.append([product_id,count])
        else:
            for i in range(len(products_cart)):
                if products_cart[i][0] == product_id:
                    products_cart[i][1]+=count
        # 更新商品列表
        for i in range(len(products)):
            if products[i][0] == product_id:
                products[i][4] -= count
    else:
        print('购物车信息如下:')
        print('*************************************')
        print('%-10s' % '编号', '%-10s' % '购买数量')
        print('-------------------------------------')
        for i in range(len(products_cart)):
            print('%-10s' % products_cart[i][0], '%6d' % products_cart[i][1])
        print('-------------------------------------')
    option = input('操作成功!请选择你的操作:1-查看商品;2-购物;3-查看购物车;其他-结账')
# 计算金额
if len(products_cart) > 0:
    amount = 0
    for i in range(len(products_cart)):
        product_index = 0
        for j in range(len(products)):
            if products[j][0] == products_cart[i][0]:
                product_index = j
                break
        price = products[product_index][3]
        count = products_cart[i][1]
        amount += price*count

    if 5000 < amount <= 10000:
        amount = amount * 0.95
    elif 10000 < amount <= 20000:
        amount = amount * 0.90
    elif amount > 20000:
        amount = amount*0.85
    else:
        amount = amount*1
    print('购买成功,您需要支付%8.2f元' % amount)

# 退出系统
print('谢谢您的光临,下次再见!')

运行截图:

task7_2

源代码:

"""
家用电器销售系统
v1.3
"""

# 欢迎信息
print('欢迎使用家用电器销售系统!')
# 商品数据初始化
products = [
    ['0001', '电视机', '海尔', 5999.00, 20],
    ['0002', '冰箱', '西门子', 6998.00, 15],
    ['0003', '洗衣机', '小天鹅', 1999.00, 10],
    ['0004', '空调', '格力', 3900.00, 0],
    ['0005', '热水器', '格力', 688.00, 30],
    ['0006', '笔记本', '联想', 5699.00, 10],
    ['0007', '微波炉', '苏泊尔', 480.00, 33],
    ['0008', '投影仪', '松下', 1250.00, 12],
    ['0009', '吸尘器', '飞利浦', 999.00, 9],
]

# 初始化用户购物车
products_cart = []

option = input('请选择您的操作:1-查看商品;2-购物;3—查看购物车;其他-结账')

while option in ['1', '2', '3']:
    if option == '1':
# 产品信息列表
        print('产品和价格信息如下:')
        print('************************************************')
        print(f'{"编号":10}{"名称":10}{"品牌":10}{"价格":10}{"库存数量":10}')
        print('-------------------------------------------------')
        for i in range(len(products)):
             print('{0[0]:10}{0[1]:10}{0[2]:10}{0[3]:10.2f}{0[4]:10d}'.format(products[i]))
        print('-------------------------------------------------')
    elif option == '2':
        product_id = input('请输入您要购买的产品编号:')
        while product_id not in [item[0] for item in products]:
            product_id = input('编号不存在,请重新输入您要购买的产品编号:')

        count = int(input('请输入您要购买的产品数量:'))
        while count > products[int(product_id)-1][4]:
            count = int(input('数量超出库存,请重新输入您要购买的产品数量:'))
        # 将所购买的商品加入购物车
        if product_id not in [item[0] for item in products_cart]:
            products_cart.append([product_id, count])
        else:
            for i in range(len(products_cart)):
                if products_cart[i][0] == product_id:
                    products_cart[i][1] += count
        # 更新商品列表
        for i in range(len(products)):
            if products[i][0] == product_id:
                products[i][4] -= count
    else:
        print('购物车信息如下:')
        print('*************************************')
        print('{:10}{:10}'.format('编号', '购买数量'))
        print('-------------------------------------')
        for i in range(len(products_cart)):
            print('{0[0]:10}{0[1]:6d}'.format(products_cart[i]))
        print('-------------------------------------')
    option = input('操作成功!请选择你的操作:1-查看商品;2-购物;3-查看购物车;其他-结账')
# 计算金额
if len(products_cart) > 0:
    amount = 0
    for i in range(len(products_cart)):
        product_index = 0
        for j in range(len(products)):
            if products[j][0] == products_cart[i][0]:
                product_index = j
                break
        price = products[product_index][3]
        count = products_cart[i][1]
        amount += price*count

    if 5000 < amount <= 10000:
        amount = amount * 0.95
    elif 10000 < amount <= 20000:
        amount = amount * 0.90
    elif amount > 20000:
        amount = amount*0.85
    else:
        amount = amount*1
    print('购买成功,您需要支付{:8.2f}元' .format(amount))

# 退出系统
print('谢谢您的光临,下次再见!')

运行截图;

task8_1

源代码:

"""
家用电器销售系统
v1.4
"""

# 欢迎信息
print('欢迎使用家用电器销售系统!')
# 商品数据初始化
products=[
  {'id':'0001','name':'电视机','brand':'海尔','price':5999.00,'count':20},
  {'id':'0002','name':'冰箱','brand':'西门子','price':6998.00,'count':15},
  {'id':'0003','name':'洗衣机','brand':'小天鹅','price':1999.00,'count':10},
  {'id':'0004','name':'空调','brand':'格力','price':3900.00,'count':0},
  {'id':'0005','name':'热水器','brand':'格力','price':688.00,'count':30},
  {'id':'0006','name':'笔记本','brand':'联想','price':5699.00,'count':10},
  {'id':'0007','name':'微波炉','brand':'苏泊尔','price':580.00,'count':33},
  {'id':'0008','name':'投影仪','brand':'松下','price':1250.00,'count':12},
  {'id':'0009','name':'吸尘器','brand':'飞利浦','price':999.00,'count':9},
  ]
# 初始化用户购物车
products_cart = []
option = input('请选择您的操作:1-查看商品;2-购物;3-查看购物车;其他-结账')
while option in ['1', '2', '3']:
    if option == '1':
        # 产品信息列表
        print('产品和价格信息如下:')
        print('*********************************************************')
        print('%-10s'%'编号','%-10s'%'名称','%-10s'%'品牌','%-10s'%'价格','%-10s'%'库存数量')
        print('---------------------------------------------------------')
        for i in range(len(products)):
            print('%-10s' %products[i]['id'], '%-10s'%products[i]['name'],'%-10s'%products[i]['brand'],'%-10s'%products[i]['price'],'%-10s'%products[i]['count'])
        print('-----------------------------------------------------')
    elif option == '2':
        product_id = input('请输入您要购买的商品编号:')
        while product_id not in [item['id'] for item in products]:
            product_id = input('编号不存在,请重新输入您要购买的产品编号:')
        count = int(input('请输入您要购买的产品数量:'))
        while count > products[int(product_id)-1]['count']:
            count = int(input('数量超出库存,请重新输入您要购买的产品数量:'))
        # 将所购买的产品加入购物车
        if product_id not in [item['id'] for item in products_cart]:
            products_cart.append({'id':product_id,'count':count})
        else:
            for i in range(len(products_cart)):
                if products_cart[i].get('id') == product_id:
                    products_cart[i]['count'] += count
    # 更新商品列表
        for i in range(len(products)):
            if products[i]['id'] == product_id:
                products[i]['count'] -= count
    else:
        print('购物车信息如下')
        print('*************************')
        print('%-10s'%'编号','%-10s'%'购买数量')
        print('-------------------------')
        for i in range(len(products_cart)):
            print('%-10s'%products_cart[i]['id'],'%6d'%products_cart[i]['count'])
        print('-------------------------')
    option=input('操作成功!请选择您的操作:1-查看商品;2-购物;3-查看购物车;其他-结账')
    # 计算金额
    if len(products_cart)>0:
        amount=0
        for i in range(len(products_cart)):
            product_index = 0
            for j in range(len(products)):
                if products[j]['id'] == products_cart[i]['id']:
                    product_index = j
                    break
            price = products[product_index]['price']
            count = products_cart[i]['count']
            amount += price*count
            if 5000 < amount <= 10000:
                amount = amount*0.95
            elif 10000 < amount < 20000:
                amount = amount*0.90
            elif amount > 20000:
                amount = amount*0.85
            else:
                amount = amount*1
            print('购买成功,您需要支付%8.2f'%amount)
        # 退出系统
        print('谢谢您的光临,下次再见!')

运行截图:

task8_2

源代码:

"""
家用电器销售系统
v1.4
"""
# 欢迎信息
print('欢迎使用家用电器销售系统!')
# 商品数据初始化
products = [
  {'id':'0001','name':'电视机','brand':'海尔','price':5999.00,'count':20},
  {'id':'0002','name':'冰箱','brand':'西门子','price':6998.00,'count':15},
  {'id':'0003','name':'洗衣机','brand':'小天鹅','price':1999.00,'count':10},
  {'id':'0004','name':'空调','brand':'格力','price':3900.00,'count':0},
  {'id':'0005','name':'热水器','brand':'格力','price':688.00,'count':30},
  {'id':'0006','name':'笔记本','brand':'联想','price':5699.00,'count':10},
  {'id':'0007','name':'微波炉','brand':'苏泊尔','price':580.00,'count':33},
  {'id':'0008','name':'投影仪','brand':'松下','price':1250.00,'count':12},
  {'id':'0009','name':'吸尘器','brand':'飞利浦','price':999.00,'count':9},
  ]
# 初始化用户购物车
products_cart = []
option = input('请选择您的操作:1-查看商品;2-购物;3-查看购物车;其他-结账')
while option in ['1', '2', '3']:
    if option == '1':
        # 产品信息列表
        print('产品和价格信息如下:')
        print('*********************************************************')
        print(f'{"编号":10}{"名称":10}{"品牌":10}{"价格":10}{"库存数量":10}')
        print('---------------------------------------------------------')
        for i in range(len(products)):
            print('{0[id]:10}{0[name]:10}{0[brand]:10}{0[price]:10}{0[count]:10}'.format(products[i]))
        print('-----------------------------------------------------')
    elif option == '2':
        product_id = input('请输入您要购买的商品编号:')
        while product_id not in [item['id'] for item in products]:
            product_id = input('编号不存在,请重新输入您要购买的产品编号:')
        count = int(input('请输入您要购买的产品数量:'))
        while count > products[int(product_id)-1]['count']:
            count = int(input('数量超出库存,请重新输入您要购买的产品数量:'))
        # 将所购买的产品加入购物车
        if product_id not in [item['id'] for item in products_cart]:
            products_cart.append({'id': product_id, 'count': count})
        else:
            for i in range(len(products_cart)):
                if products_cart[i].get('id') == product_id:
                    products_cart[i]['count'] += count
    # 更新商品列表
        for i in range(len(products)):
            if products[i]['id'] == product_id:
                products[i]['count'] -= count
    else:
        print('购物车信息如下')
        print('*************************')
        print('{:10}{:10}'.format('编号', '购买数量'))
        print('-------------------------')
        for i in range(len(products_cart)):
            print('{0[id]:10}{0[count]:6d}'.format(products_cart[i]))
        print('-------------------------')
    option = input('操作成功!请选择您的操作:1-查看商品;2-购物;3-查看购物车;其他-结账')
    # 计算金额
    if len(products_cart) > 0:
        amount = 0
        for i in range(len(products_cart)):
            product_index = 0
            for j in range(len(products)):
                if products[j]['id'] == products_cart[i]['id']:
                    product_index = j
                    break
            price = products[product_index]['price']
            count = products_cart[i]['count']
            amount += price*count
            if 5000 < amount <= 10000:
                amount = amount*0.95
            elif 10000 < amount < 20000:
                amount = amount*0.90
            elif amount > 20000:
                amount = amount*0.85
            else:
                amount = amount*1
            print('购买成功,您需要支付{:8.2f}元' .format(amount))
        # 退出系统
        print('谢谢您的光临,下次再见!')

运行截图:

 

标签:语句,count,product,编程,数据类型,cart,products,print,id
From: https://www.cnblogs.com/Hj-soo320/p/17347875.html

相关文章

  • 每日编程一小时(第十四天)
    一.问题描述编写程序:用二分法在有序表{3,4,10,13,33,42,46,63,76,78,95,96,120}中查找一个给定的数。 二.设计思路1.定义一个数组a存入上面的数,按从小到大排序2.输入一个数n3.设计一个函数f(a,0,13,n),取中间值mid=1+13/2,比较a[mid]和n的大小,若right-left>1&&a[mid]!=x,有......
  • 编程一小时2023.4.23
    1.#include<bits/stdc++.h>usingnamespacestd;stringa,s;intb[1005],t,c[1005];voiddivision(){for(inti=t-1;i>=0;i--){if(b[i]%2)b[i-1]+=10;b[i]/=2;}while(b[t-1]==0)t-......
  • 编程打卡:给网页做个花里胡哨个格子纹理背景吧。
    编程打卡:给网页做个花里胡哨个格子纹理背景吧。嗯看到Github上面有一个项目,格裙纹理生成器稍微玩了一会儿,感觉这样的纹理或许可以用来做网页的背景,就这样做了。这个项目生成的图片,感觉太精细了,,稍微一个SVG,就有好几MB大,虽然确实惊喜,里面的纹理,用来做裙子什么的说不定真的可以,但......
  • 编程计划
    大二在读......
  • 并发编程(1)-线程与锁
    1.什么是线程?线程的状态与进程的状态非常相似,但线程是在进程内运行的轻量级实体。线程与进程的主要区别是线程共享相同的地址空间,而进程具有独立的地址空间。这意味着在进程中运行的每个线程都可以访问相同的变量和数据结构,而在不同进程中运行的线程则不能访问彼此的变量和数据......
  • java 编程 习惯
    (1)类名首字母应该大写。字段、方法以及对象(句柄)的首字母应小写。对于所有标识符,其中包含的所有单词都应紧靠在一起,而且大写中间单词的首字母。例如:ThisIsAClassNamethisIsMethodOrFieldName若在定义中出现了常数初始化字符,则大写staticfinal基本类型......
  • 实验三 控制语句与组合数据类型应用编程
    task1源代码1importrandom23print('用列表存储随机整数:')4lst=[random.randint(0,100)foriinrange(5)]5print(lst)67print('\n用集合存储随机整数:')8s1={random.randint(0,100)foriinrange(5)}9print(s1)1011print('......
  • python + informix+基本语句
    importjaydebeapiimportosimportloggingimporttimeclassPostgre_Person:def__init__(self):#打开数据库连接foriinrange(10):try:url=###user=###password=##......
  • Mysql查询语句进阶知识集锦
    前言上次咱们简单的学习了一下select的用法,一篇文章教会你进行Mysql数据库和数据表的基本操作,对数据库大概有了一些基本的了解。咱们接着上次继续来看叭!查询数据如下or查询我们在上学时,会听到这样的话,某某某,你把谁谁谁或者谁谁谁叫过来。这样子的话,我们我们要查询的,就是一个或......
  • 《Linux基础》09. Shell 编程
    目录1:Shell简介2:Shell脚本2.1:规则与语法2.2:执行方式2.3:第一个Shell脚本3:变量3.1:系统变量3.2:用户自定义变量3.2.1:规则3.2.2:基本语法3.2.3:示例3.3:自定义环境变量4:位置参数变量4.1:语法4.2:示例5:预定义变量5.1:语法5.2:示例6:读取标准输入7:运算符8:条件判断8.1:基本判断8.2:文件权限判断8......