Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> print("Python"+str(3.7))
Python3.7
>>> print("Python"+3.7)
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
print("Python"+3.7)
TypeError: can only concatenate str (not "float") to str
>>> a=2
>>> b=3
>>> c=a**b
>>> print(c)
8
>>> a
2
>>> b
3
>>> d
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
d
NameError: name 'd' is not defined
>>> print('hello,world')
hello,world
>>> print('hello','world')
hello world
>>> print('hello'+'world')
helloworld
>>> print('a'*3)
aaa
>>> a=3
>>> (float)a
SyntaxError: invalid syntax
>>> print(5/3)
1.6666666666666667
>>> print(5//3)
1
>>> print(float(8))
8.0
>>> type(4/2)
<class 'float'>
>>> 4/2
2.0
>>> n=input('请输入奶牛的头数')
请输入奶牛的头数10
>>> day=7
>>> product=20
>>> print(n+'头奶牛'+day+'天可以产'+day*product*n+'千克的牛奶')
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
print(n+'头奶牛'+day+'天可以产'+day*product*n+'千克的牛奶')
TypeError: can only concatenate str (not "int") to str
>>> print(str(n)+'头奶牛'+str(day)+'天可以产'+str(day*product*n)+'千克的牛奶')
10头奶牛7天可以产1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010千克的牛奶
>>> d=day*product*n
>>> print(d)
1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010
>>> d=day*product
>>> print(d)
140
>>> d=d*n
>>> print(d)
1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010
>>> print(n)
10
>>> type(n)
<class 'str'>
>>> d=day*product*int(n)
>>> print(d)
1400
>>> print(str(n)+'头奶牛'+str(day)+'天可以产'+str(d)+'千克的牛奶')
10头奶牛7天可以产1400千克的牛奶
>>>
没有合适的资源?快使用搜索试试~ 我知道了~
python入门奶牛问题

共1个文件
py:1个

需积分: 5 80 浏览量
2023-06-02
16:44:18
上传
评论
收藏 799B ZIP 举报
温馨提示
python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门奶牛问题python入门
资源推荐
资源详情
资源评论



















收起资源包目录


共 1 条
- 1
资源评论


落雨~星辰
- 粉丝: 1
- 资源: 17
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


安全验证
文档复制为VIP权益,开通VIP直接复制
