#01-1
#こんにちは と画面に表示する
print('こんにちは')
#01-2
#自分の名前を表示する
print('自分の名前')
#02
print(2**10)
print(54321%17)
#03
print('Hello','World')
print('第',3,'回')
#04
name='自分の名前'
school='立川高校'
print(name,school)
#05
tenki=input('天気は?')
print('今日は',tenki,'ですね')
#06-1
moji=input()
suuti=int(moji)
print(suuti**5)
#06-2
hankei=int(input('半径?'))
print(3.14*hankei**2)
以下の条件を満たすプログラムを作成せよ
#07
A=int(input())
B=int(input())
print(A*B)
#08-1
num=int(input('Number?'))
if num>5:
print(1)
else:
print(0)
#08-2
num=int(input('Number?'))
if num>=175:
print('L')
else:
print('M')
#09-1
for i in range(100):
print(i+1)
#09-2
for i in range(2,101,2):
print(i)
#10-1
S=0
for i in range(1000):
S=S+i+1
print(S)
#10-2
S=1
for i in range(15):
S=S*(i+1)
print(S)
#11
for i in range(50):
num=i+1
if num%4==0:
print(num)
#12
S=0
for i in range(100):
num=i+1
if num%6==0:
S=S+num
print(S)
#13
suu=int(input('Number?'))
for i in range(suu):
num=i+1
if num%4==0:
print(num)
#14-1
S=0
for i in range(30):
num=i+1
if num%4==0:
print(num)
S=S+num
print('和は',S)
#14-2
S=1
for i in range(15):
num=i+1
if num%3==0:
print(num)
S=S*num
print('積は',S)
#15-1
for i in range(12,20,3):
print(i)
#15-2
for i in range(10,-1,-2):
print(i)
問題1
問題2
moji=['A','B','C','D','E']
#16-1
moji=['A','B','C','D','E']
print(moji[1])
#16-2
moji=['A','B','C','D','E']
for i in range(5):
print(moji[4-i])
#17
S=0
L=[]
for i in range(30):
num=i+1
if num%4==0:
L.append(num)
S=S+num
print(L)
print(S)
#18
S=0
L=[]
C=0
for i in range(30):
num=i+1
if num%4==0:
L.append(num)
S=S+num
C=C+1
print(L)
print(S/C)
#19
suu=input().split()
V=1
for i in range(len(suu)):
num=int(suu[i])
V=V*num
print(suu)
print(V)
#20
num=0
while num<10:
print('羊が',num+1,'匹')
num=num+1
#21
num=0
while num<10:
num=int(input('数を入力'))
if num<10:
print('もう一度')
print('当たり')
#22
age=int(input('年齢を入力'))
if age>=18:
print('Adult')
elif age>=12:
print('Young')
else:
print('Child')
#23
suu=int(input('数を入力'))
waru=2
warikire=False
while warikire==False:
if suu%waru==0:
print(suu,'は',waru,'で割り切れます')
warikire=True
else:
waru=waru+1
以下の条件を満たすプログラムを作成せよ
#24
suu=int(input('Number?'))
sosu=True
for i in range(2,suu):
if suu%i==0:
sosu=False
if sosu==True:
print(suu,'は素数')
else:
print(suu,'は素数でない')
#25
suu=int(input('Number?'))
for j in range(2,suu):
sosu=True
for i in range(2,j):
if j%i==0:
sosu=False
break
if sosu==True:
print(j)
#26
suu=int(input('Number?'))
maxsosu=0
for j in range(2,suu):
sosu=True
for i in range(2,j):
if j%i==0:
sosu=False
break
if sosu==True:
maxsosu=j
print(maxsosu)
#26(別解)
suu=int(input('Number?'))
for j in range(suu-1,2,-1):
sosu=True
for i in range(2,j):
if j%i==0:
sosu=False
break
if sosu==True:
print(j)
break
#27
suu=int(input('Number?'))
sosu=False
if suu<2:
suu=2
sosu=True
while sosu==False:
suu=suu+1
for i in range(2,suu):
if (suu)%i==0:
sosu=False
break
else:
sosu=True
print(suu)