Python学習宿題1

1600 ワード

#  、     
i = 1
while i <= 9:
j = 1
while j <= i:
print(f'{j}*{i}={i*j}', end='\t')
j += 1
print()
i += 1
else:
print(' ')

# 、 ( )
import random
List_R = [[], [], []]
List_T = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']
for name in List_T:
num = random.randint(0, 2)
List_R[num].append(name)
print(List_R)
i = 1
for office in List_R:
print(f' {i} {len(office)}, :')
for name in office:
print(f'{name}', end='
')
i +=1

# 、 ( )
import random
List_R = [[], [], []]
List_T = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']
for name in List_T:
num = random.randint(0, 2)
if len(List_R[num]) < 3:
List_R[num].append(name)
else:
List_T.append(name)
print(List_R)
i = 1
for office in List_R:
print(f' {i} {len(office)}, :')
for name in office:
print(f'{name}', end='
')
i +=1


1、 ,
2、 , Python:for “ ”
3、 : 、 、
4、 :
  1、 : list dictionary
  2、 :int string float tuple

1、Python sort(), ?