请问哪里错了

来源:4-5 编程练习

weixin_慕莱坞8003161

2019-05-09 22:11:37

date = input("请输入日期")#定义变量date,接收input函数—请输入日期:1999
print(date)
str1=" Welcom to imooc"
str2="  Imooc's URL is https://www.imooc.com/"
#定义变量str3拼接date、str1、str2
str3 =' int(date) + " +str(str1)" + "str(str2)"'
print(str3)


写回答

4回答

晞晞他爹

2019-05-28

python字符串拼接只能是字符串+字符串

input输入返回的date本身就是字符串,并不需要转换成int

所以将int(date)修改为date即可正确运行程序,望采纳.



0

慕猿梦

2019-05-11

同学,您好,您的str3变量接收的是一整串字符串,而不是拼接,参考解决方案如下图:

http://img.mukewang.com/climg/5cd6de1500017b2105880251.jpg

如果我的回答解决了你的疑惑,欢迎采纳!!祝学习愉快~~~~~

0

AJ686

2019-05-10

date = input("请输入出行日期:")
str1 = " welcom to imooc "
str2 = "imooc's url is http://www.imooc.com"
str3 = date + str1 + str2
print(str3)

0

tkpromise

2019-05-10

date = input('请输入日期:')
str1=" Welcom to imooc"
str2="  Imooc's URL is https://www.imooc.com/"
#定义变量str3拼接date、str1、str2
str3 = date + str1 + str2
print(str3)

请参照以上源码

0

0 学习 · 8160 问题

查看课程