Jta Jta - 1 year ago 310
Python Question

PyCharm Edu introduction course, string multiplication

I'm new to Python and currently running the "Introduction to Python" course for PyCharm Edu. I'm having a problem with the following task (strings -> string multiplication)

Python supports a string-by-number multiplication (but not the other
way around!).

Use hello to get the
"hellohellohellohellohellohellohellohellohellohello" string ("hello"
repeated 10 times).

The default given code is

hello = "hello"
ten_of_hellos = hello operator 10

so I just replace the word operator with the * sign, so I have

hello = "hello"
ten_of_hellos = hello * 10

but I get an error saying "use multiplication". Any idea of what I'm doing wrong?

Answer Source

If anyone else is completing the PyCharm Edu tutorial I noticed a problem with the string_multiplication exercise. When attempting to complete the solution an error messsage "Use multiplication" occurs. This is due to the source code of the PyCharm project. For anyone interested the solution is to go into you file system directory where the program is located:

enter image description here

Open the .py file and insert the missing "else" (highlighted in gray): enter image description here

Click the Check Task button in PyCharm Edu to see the solution is complete.

This was a solution found by GitHub user lbilger. Source

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download