#1: Python Slicing of Lists & Strings | Python Best Practices

preview_player
Показать описание
Step by step video tutorials to learn Python for absolute beginners!

Starting today, we are creating a new series of Python videos where you will learn about best practices in Python to write clean, readable, and more Pythonic code.

In this video, we will learn about the slicing of lists and strings, which allows us to build new lists from an existing list or string.

~

Watch our videos and revise them with our Python App!

Timestamps:
0:00 Intro
0:21 List Indexing
1:56 Slicing of Lists
5:00 Using Step in Slicing
6:40 Reversing a List using Slicing
7:25 Changing Multiple List Items

Find Programiz elsewhere:

#programiz #python #learnprogramming #learnpython #pythonslicing
Рекомендации по теме
Комментарии
Автор

Why are you so underrated sir you deserve more subs and views for your unique short videos

justtfunny
Автор

thank god i found yr channel, bro i paid thousands of dollars for nothing. best channel highly recommended for ug cs students 💯💯

LubahMuslimah
Автор

Clear-cut explanation. I am learning Python wish me good luck

AbhinavKumar-dref
Автор

Thank you, your video helped me understand list slicing better

Official_Vickkhie
Автор

You deserve so much more subs, you got the best python channel on YT! I’ve been learning a lot from your videos man, thanks a lot 🙏🏻

maikecunhamusic
Автор

Your videos are great ! Just one comment about the word "revise". If I revise a lesson it means I make changes to it. If I review a lesson it means I look at it again to remind myself of things I may have forgotten.

DavidBellis-mu
Автор

Cool, Learned Python Using Programming Hero.

marktoniz
Автор

Thanks for these videos. They are really helpful.

stanleyezeogu
Автор

It would be nice if you outlined what exactly is happening when we take slices of lists: e.g. is a list slice, say numbers[2:4], actually a new object which we can then assign to a new variable new_numbers. What is happening beneath all this. And contrast this with what happens when we slice strings. And why we could use e.g. numbers[2, 4] like a variable on the left hand side of an assignment to change elements of numbers, which I don't think you can do with strings. What you did seems to present a very superficial understanding of what is actually going on for slicing of lists.

markkennedy
Автор

Hello Programiz,
I used your online compiler many times, but sometimes it creates a lot of problems I don't know if it's oversensitive or if it is a bug please try to fix this problem .

StarUnite
Автор

what happen if we use negative number in place of step

mdmateen
Автор

what if I want receive eg [-1: -4] ? its empty output if I use this method

gorgecartov
Автор

Can anyone tell me which font is that??

lightyagami
Автор

Did you forget to do the string slicing??

SwatiTiwari
Автор

Punit is the fastest typer of the WORLD

GiulioVonKerman
Автор

Make mobile user friendly and some colour pleasant for eyes

nandinirm
Автор

If suppose I want to swap words in the string, how can I do it?
example: John knows Python and Sundar knows Java
I want to swap Java with Python and Python with Java.
Solution:
for i in range(len(text)):
if "Python" in text[i]:n = = text[i][:n] + "Java" + text[i][n + 6:]
elif "Java" in text[i]:n = text[i].index("Java");text[i] = text[i][:n] + "Python" + text[i][n + 4:]
But I couldn't understand what is text[i][:n] + "Java" + text[i][n+6]
Could you please explain?
Thanks :-)

MKSundaram
Автор

This is not "best practices". It's more like programming tutorial. Misleading...

peskenis
Автор

You guys never mention how to use "gets/puts". Did you guys forget to do this?

glorymanheretosleep