Skip to content
This repository was archived by the owner on Feb 27, 2026. It is now read-only.

Commit 1e344bd

Browse files
Removed the Codebyte section due to compiler error
1 parent f953916 commit 1e344bd

1 file changed

Lines changed: 0 additions & 20 deletions

File tree

content/python/concepts/strings/terms/removeprefix/removeprefix.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,3 @@ The code will produce this output:
6767
```shell
6868
project/data/file.txt
6969
```
70-
71-
## Codebyte: Manual vs built-in removal
72-
73-
In this example, a prefix is removed manually with [`.startswith()`](https://www.codecademy.com/resources/docs/python/strings/startswith) and then using `.removeprefix()` for comparison:
74-
75-
```codebyte/python
76-
phrase = "Python is Awesome"
77-
prefix = "Python"
78-
79-
# Approach 1: Manual removal
80-
if phrase.startswith(prefix):
81-
result = phrase[len(prefix):]
82-
print(result.strip())
83-
else:
84-
print(phrase)
85-
86-
# Approach 2: Using removeprefix()
87-
result2 = phrase.removeprefix(prefix)
88-
print(result2.strip())
89-
```

0 commit comments

Comments
 (0)