for i in range(1, 101): # 1부터 100까지 100번 반복
if i % 3 == 0 and i % 5 == 0: # 3과 5의 공배수일 때
print('FizzBuzz', end=' ') # FizzBuzz 출력
elif i % 3 == 0: # 3의 배수일 때
print('Fizz', end=' ') # Fizz 출력
elif i % 5 == 0: # 5의 배수일 때
print('Buzz', end=' ') # Buzz 출력
else:
print(i, end=' ')
for i in range(1, 101):
print('Fizz' * (i % 3 == 0) + 'Buzz' * (i % 5 == 0) or i, end=' ')

** 규칙
1~10사이의 Random한 값 1개 맞추기
맞출때까지 계속 진행
몇번만에 맞췄는 지 출력
import random
# 1 ~ 9 com 숫자 맞추기
com = int(random.random() * 9) + 1
print('com =',com)
count = 0
while True:
count += 1 # count++ => X
user = int(input('user > '))
if com == user:
break;
print(f'{count}번만에 빙고')

for i in range(1,26):
if i < 10:
print(i, end=' ')
else:
print(i, end=' ')
if i % 5 == 0:
print()

n = 6
for i in range(1,7):
for j in range(1,7):
if i + j == n:
print(f'({i},{j})', end= '')

import random
sortNum = []
for i in range(10):
n = random.randint(1,45)
sortNum.append(n)
sortNum
for i in range(len(sortNum)-1):
if sortNum[i] > sortNum[i+1]:
check = True
tmp = sortNum[i]
sortNum[i] = sortNum[i+1]
sortNum[i+1] = tmp
print(sortNum) # 변화 값 확인

import random
lottoOne = set()
while True:
lottoOne.add(random.randint(1,45))
if len(lottoOne) == 6:
break
lottoOne

import random
lottoOne = set()
lottoFive = list()
while True:
lottoOne.add(random.randint(1,45))
if len(lottoOne) == 6:
lottoFive.append(lottoOne)
lottoOne = set()
if len(lottoFive) == 5:
break
lottoFive
