I have started learning Python today and I am facing a problem while doing "slice" in Python. I saw Brocod's video but after following him the problem wasn't solved.
website="http//google.com"
slice=slice(7,-4)
print(website[slice])
And The output I am getting:
[Running] python -u "d:\Learning\BroCode\Python\String_slice.py"
oogle
[Done] exited with code=0 in 0.505 seconds
I tried to rewrite the code, reinstalling Vs code but none of them worked.
Read the doc carefully : https://www.programiz.com/python-programming/methods/built-in/slice
Your string index starts from 0 so
gis the 7th index, which is 6.You should do :
to get
google