Python Forum
Python Forum
>
Python Coding
>
Homework
> What would be a substitute for "::"
Full Version:
What would be a substitute for "::"
You're currently viewing a stripped down version of our content.
View the full version
with proper formatting.
hhydration
Oct-10-2020, 10:08 PM
The use of :: is prohibited for certain assignments, what would be a substitute that would allow you to do things like print every other character in a string?
scidam
Oct-10-2020, 11:21 PM
If slicing is allowed for the object, you can use it directly, e.g.:
'a string'[slice(None, None, 2)]
Python Forum
>
Python Coding
>
Homework
> What would be a substitute for "::"