我是Python新手,目前正在为PyCharm Edu运行"Python简介"课程.我遇到以下任务的问题(字符串 - >字符串乘法)
Python支持逐个数字的乘法(但不是相反的方式!).
使用hello获取"hellohellohellohellohelhellohellohellohellohellohello"字符串("hello"重复10次).
默认的给定代码是
hello = "hello"
ten_of_hellos = hello operator 10
print(ten_of_hellos)
Run Code Online (Sandbox Code Playgroud)
所以我只用*符号替换单词运算符,所以我有
hello = "hello"
ten_of_hellos = hello * 10
print(ten_of_hellos)
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误说"使用乘法".我知道我做错了什么?
| 归档时间: |
|
| 查看次数: |
1892 次 |
| 最近记录: |