一行,3科成绩,用空格分隔,范围(0~100)。
一行,把3科成绩显示出来,输出格式详见输出样例。
60 80 90
score1=60,score2=80,score3=90
# -*- coding=utf-8 -*- score = [] score = input().split() for i in range(len(score)): print('score%s=%s' % (i+1, score[i]),end='') if i<len(score)-1: print(',',end='')
a,b,c=eval(input().replace(' ',',')) print("score1={},score2={},score3={}".format(a,b,c))
a,b,c = map(int,input().split()) print("score1={0},score2={1},score3={2}".format(a,b,c))
直接对输入按空格切片
score = input() print('score1={0},score2={1},score3={2}'.format(score.split( )[0], score.split( )[1],score.split( )[2]))
import re score = input('') pat = '\d{0,3}\S' a = re.compile(pat).findall(score) print('score1={0},score2={1},score3={2}'.format(a[0],a[1],a[2]))
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题