問題
pinが1234の時だけ「あたり」が表示され、違う時は「違います」となるプログラム
問題
"Happy Birthday"のHappyのみ表示させるプログラム
問題
75 100 60 85 90の平均を出すプログラム
問題
[75,80,65] [100,70,90] [60,50,100] [85,80,75] [90,65,70]] と表示するプログラム
問題
1,3,5,2,3,1,5,4,6,4,7の重複している数字を消すプログラム
問題
10/3で商3、あまり1 (3,1)を出力する、プログラム
問題
blueberryの文字数を表示するプログラム
問題
msg='Hello' msg[1] で表示されるのは
問題
code='123456789ABC' code[::3] で表示されるのは
問題
code='123456789ABC' code[9:20] で表示されるのは
python
得点
0 / 10
正答率
0%
正解: 0
不正解: 0
未解答: 10
問題一覧
1
pinが1234の時だけ「あたり」が表示され、違う時は「違います」となるプログラムwhile True: pin=input("pinを入力") if (pin =="1234"): print("当たりです!") break else: print("違います")
2
"Happy Birthday"のHappyのみ表示させるプログラムmessage="Happy Birthday" message[:5]
3
75 100 60 85 90の平均を出すプログラムscores=[75,100,60,85,90] goukei=0 for score in scores: goukei+=score heikin=goukei/len(scores) print(heikin)
4
[75,80,65] [100,70,90] [60,50,100] [85,80,75] [90,65,70]] と表示するプログラムscores=[[75,80,65],[100,70,90],[60,50,100],[85,80,75],[90,65,70]] for score in scores: print(score)
5
1,3,5,2,3,1,5,4,6,4,7の重複している数字を消すプログラムnumber=[1,3,5,2,3,1,5,4,6,4,7] temp=set(number) number=list(temp) number
6
10/3で商3、あまり1 (3,1)を出力する、プログラムdef divison(a,b): syo=a//b amari=a%b return syo,amari answer=divison(10,3) print(answer)
7
blueberryの文字数を表示するプログラムdef strlen(target): cnt=0 for s in target: cnt+=1 return cnt n=strlen("blueberry") print(n)
8
msg='Hello' msg[1] で表示されるのは'e'
9
code='123456789ABC' code[::3] で表示されるのは'147A'
10
code='123456789ABC' code[9:20] で表示されるのは'ABC'
11
print('{:.2f}'.format(10.12345)) print('{:.2f}'.format(10.34567)) print('{:.2f}'.format(10)) で出力されるのは10.12 10.35 10.00
12
apple prineapple banana にpがいくつふくまれるか出力するプログラム apple prineapple bananaをaとおいて記述せよstrs = 'a' strs.count('p')
13
def func(a,b,*args): print(a,b,args) return func(1,2,3,10,20) の出力1 2 (3,10,20)
14
numbers=[1,2,3,4,5,6,7,8,9] numbers[:3]=[0] numbers この時の出力は[0,4,5,6,7,8,9]
15
numbers=[1,2,5,3,4,5,6,7,8,5] numbers.index(5)で出力されるのは2