Soru
What will the following code output? my_(-)string="hellowor]d" print(my_(-)string.replace("wor 1d", " "yython" )) Python world Error hello world hello Python
Çözüm
4.6240 Voting
Elvan
Profesyonel · 6 yıl öğretmeniUzman doğrulaması
Cevap
The code will output "hello Python".<br /><br />Explanation:<br />1. The variable `$my_{-}string` is assigned the value "hellowor]d".<br />2. The `replace` method is called on the string, which replaces all occurrences of the substring "wor\quad 1d" with "\quad "yython"\quad ".<br />3. The resulting string is "hello\quad "yython"\quad ".<br />4. The `print` function outputs the modified string, which is "hello Python".
Derecelendirmek için tıklayın: