大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺
Python 学习笔记 列表 range() xxx XXX
print("-" * 30)
for value in range(1, 5):
print(value)
numbers = list(range(1, 6))
print(numbers)
even_numbers = list(range(2, 11, 2))
print(even_numbers)
squares = []
for value in range(1, 11):
square = value ** 2
squares.append(square)
print(squares)
print("-" * 30)
digits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print("min: {}".format(str(min(digits))))
print("max: {}".format(str(max(digits))))
#sum = sum(digits)
#print("sum: {}".format(sum))
a = sum(digits)
print(a)
print("-" * 30)
squares = [value ** 2 for value in range(1, 11)]
print(squares)
print("-" * 30)
for num in range(1, 21):
print(num, end = " ")
print("\n")
num_100w = list(range(1, 1000001))
#for n in num_100w:
# print(n)
print("-" * 30)
print(min(num_100w))
print(max(num_100w))
print(sum(num_100w))
print("-" * 30)
num_2 = list(range(1, 21, 2))
print(num_2, end = " ")
print("\n")
for n2 in num_2:
print(n2)
print("\n")
num_3 = list(range(3, 31, 3))
for n3 in num_3:
print(n3, end = " ")
print("\n")
lf = list(range(1, 11))
for l_f in lf:
value = l_f ** 3
print(value)
print("\n")
lf_2 = [value ** 3 for value in range(1, 11)]
print(lf_2)
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/172141.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...