简单的输入输出:编程实现输入姓、名的提示语并接受用户输入,并单独显示姓、名和全名,执行效果如下所示:Input your surname:ZHANG Input your firstname:DazhuangYour surname is:ZHANGYour firstname is:DazhuangYour full name is:ZHANG Dazhuang
2 回答
已采纳
清波
TA贡献165条经验 获得超90个赞
Python 2.x:
surname = raw_input("Input your surname: ") firstname = raw_input("Input your firstname: ") print "Your surname is:\n",surname print "Your firstname is:\n",firstname print "Your full name is:\n",surname , firstname
Python 3.x:
surname = input("Input your surname: ") firstname = input("Input your firstname: ") print ("Your surname is:",surname,sep="\n") print ("Your firstname is:",firstname, sep='\n') print ("Your full name is:",surname+' '+firstname,sep='\n')
guozhchun
TA贡献103条经验 获得超76个赞
surname = raw_input("Input your surname: ") firstname = raw_input("Input your firstname: ") print "Your surname is:" print surname print "Your firstname is:" print firstname print "Your full name is:" print surname + " " + firstname
添加回答
举报
0/150
提交
取消