Indexes and slices - Python 3 Programming Tutorial p.5

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 พ.ย. 2024

ความคิดเห็น • 53

  • @airsoft10125
    @airsoft10125 6 ปีที่แล้ว +63

    Recorded at 3AM. Love it.

    • @kegjnote
      @kegjnote 6 ปีที่แล้ว +3

      looks like the sun is out though

    • @HellTriX
      @HellTriX 6 ปีที่แล้ว +7

      I watched it at 3AM lol

    • @arunsivakumar4267
      @arunsivakumar4267 4 ปีที่แล้ว

      I'm watching it at 3 am!

  • @dishant-gupta
    @dishant-gupta 6 ปีที่แล้ว +23

    It's daily routine now hope I can learn machine learning after it😅

    • @pretendcampus5410
      @pretendcampus5410 5 ปีที่แล้ว +2

      How is it going? I am mostly interested in machine learning. What do you recommend after this series? Can I learn machine learning and or data analysis directly after this?

    • @shivatejachavali787
      @shivatejachavali787 5 ปีที่แล้ว +1

      oh yes diahnt tell us wered you go which playlist/series to choose after this?

  • @ananttodwal5881
    @ananttodwal5881 5 ปีที่แล้ว +3

    Your tutorials are interesting 👌🏼😬

  • @Thomas-ob5fe
    @Thomas-ob5fe 6 ปีที่แล้ว +2

    First of all, I really love that you're redoing your Python3 series....and you've a nice smooth teaching voice - which is always quite beneficial if your trying to learn something new!
    May i ask if you're going to introduce also VS Code and therefore it's Python3 environment?
    I doing computer only stuff when it's nice and bright light outside. So i do that stuff often at night times (way too often till the sunrise) *thumbs up*

    • @sentdex
      @sentdex  6 ปีที่แล้ว +1

      Not planning to spend more time on editors.

  • @yakunats
    @yakunats 3 ปีที่แล้ว +2

    Disregarded one Pep 8 guideline by assigning a variable as l (i.e. lowercase L)... Threw me for a bit of a loop there thinking it was number 1

  • @BrendanMetcalfe
    @BrendanMetcalfe 2 ปีที่แล้ว

    Nice!

  • @frosty9392
    @frosty9392 5 ปีที่แล้ว +2

    3:45 this probably doesn't have an answer other than "because".. but wouldn't it make more sense for it to be
    "game[0[1]]"
    (^ doesn't work, i tried lol)
    it seems like it'd be a lot easier to keep track of super nested stuff that way

    • @differntname2807
      @differntname2807 2 ปีที่แล้ว +1

      It's because game[0] calls the list at game[0], aka [0,0,0]. So game[0][1] is equivalent to [0,0,0][1].

  • @strangekino3991
    @strangekino3991 6 ปีที่แล้ว

    Loving it

  • @vigneshlakshmanan8855
    @vigneshlakshmanan8855 6 ปีที่แล้ว

    Have you done any tutorial series on Web authentication methods? How to scrap or navigate through websites that requires authentication?

  • @joshuaburnworth8611
    @joshuaburnworth8611 3 ปีที่แล้ว

    I'm trying to print multiple elements from a list on a line together. Specifically two at a time. Using a for loop I am able to print the elements all on separate lines. I can't seem to find a solution within the videos.

  • @shritamkumarmund5273
    @shritamkumarmund5273 6 ปีที่แล้ว +1

    Hey!
    This is my input:
    a = [10, 20, 30, 40, 50, 60, 70]
    print(a[::5])
    output:
    [10, 60]
    Can you tell me what is going on here?

    • @Random4Logic
      @Random4Logic 6 ปีที่แล้ว +7

      You are doing a "slice" here. Which is another way to output a list.
      Thats basically the syntax inside the brackys:
      [start:end:step]
      Start: at which index do you start printing
      end: and which index do you end printing (excluding) so a index of [5] stops after printing [4]
      step: how big is the step you are going through.
      In other words. You print everything starting at the first index ending at the last. But you have a step-range of 5.
      So it prints every 5th element starting at 0. Which in this case is the Element with Index [0] and [5].
      thats why your output is [10,60]

    • @shritamkumarmund5273
      @shritamkumarmund5273 6 ปีที่แล้ว +2

      @@Random4Logic That's really a helpful replay. I didn't know about the Step. Thank You!

    • @utkarsharya7330
      @utkarsharya7330 4 ปีที่แล้ว

      because when we take range one value is reduced like in (1,6) the output comes out to be [1,2,3,4,5].

  • @dawah7556
    @dawah7556 6 ปีที่แล้ว +1

    i think you should do a series on seaborn too. By the way thanks

    • @sentdex
      @sentdex  6 ปีที่แล้ว +2

      I may at some point, but thats pretty far down my list of priorities.

  • @jayanthr5184
    @jayanthr5184 4 ปีที่แล้ว

    print (l[1:3])- Hw does this print 2 and 3 since it indicate the indexes, it should actually print 2,3 and 4 right.. Can you pls clarify?

    • @joenathan6458
      @joenathan6458 4 ปีที่แล้ว +1

      For [1:3] the 1 indicates the place in the index. The 3 is the actual number inside the list.
      1 is where ii begins, 3 is where it ends
      So using l=[1,2,3,4,5]
      [1:4] would show [2,3,4]

  • @imtiazahmad7826
    @imtiazahmad7826 6 ปีที่แล้ว +7

    You are like me do programming at night. I think programmers have no specific time for programming whenever we get time we code

  • @wismilak1000
    @wismilak1000 5 ปีที่แล้ว

    what happened to the indistinct chatter + frequency sound (if I'm not mistaken) on the intro of your tutorials?

    • @sentdex
      @sentdex  5 ปีที่แล้ว

      People complained :P been like 2+ years since I used it.

  • @RohanD20
    @RohanD20 5 ปีที่แล้ว

    In print(l[1:3]) it prints from 1st index to 2nd index.But it should print till 3rd index right?Is the 3 not the index?Could you please explain

  • @LabGecko
    @LabGecko 6 ปีที่แล้ว

    At 3:10 "...that would be a mistake..." Why!? When we know why things shouldn't be used, we will also learn when they *should* be used.

    • @sentdex
      @sentdex  6 ปีที่แล้ว +1

      Because of what I said leading up to that. I literally explained why it'd be a mistake the seconds prior. Go back and listen.

    • @Deserthacker
      @Deserthacker 5 ปีที่แล้ว +1

      It's been a while since you commented, but maybe someone else stumbles upon this. It would not really be a mistake to use just a list of numbers instead of a list of lists of numbers. It would complicate your code though, because instead of doing game[2][2] to access the spot in the lower right you would have to do game[8] which is not really intuitive. Yes, it would be a tad more memory efficient to just use a single dimension, but readability of your code matters more. Readability prevents bugs, makes code easier to maintain and often (like in this example) easier to write.
      Edit: Also, printing the playing field would be more difficult

  • @onesimuschandrapradhan6055
    @onesimuschandrapradhan6055 5 ปีที่แล้ว +1

    How to type a square brackets in keyboard

  • @kevinsheng8775
    @kevinsheng8775 4 ปีที่แล้ว

    Write code that uses slicing to get rid of the the second 8 so that here are only two 8’s in the list bound to the variable nums.
    nums = ['4, 2, 8, 23.4, 8, 9, 545, 9, 1, 234.001, 5, 49, 8, 9 , 34, 52, 1, -2, 9.1, 4'] ???
    Anyone can figure this one out?

  • @lank_asif
    @lank_asif 6 ปีที่แล้ว +2

    sentdex I beg of you, PLEASE remove that comma after game[2] and the closing square brace lol

    • @sentdex
      @sentdex  6 ปีที่แล้ว +6

      *remembers to make more of the trailing commas just for you*

    • @lank_asif
      @lank_asif 6 ปีที่แล้ว +2

      @@sentdex *nooooooooo!!* Hahahaha

    • @Deserthacker
      @Deserthacker 3 ปีที่แล้ว

      @@lank_asif Trailing comma is the way. At the very least it makes it a tiny bit easier to move lines around.

  • @annarosegacha7937
    @annarosegacha7937 5 ปีที่แล้ว

    Hey! What type of laptop/pc would you recommend?

    • @sentdex
      @sentdex  5 ปีที่แล้ว +3

      Whatever you can afford and like. Just about anything will do.

  • @hasanfarahani340
    @hasanfarahani340 6 ปีที่แล้ว +14

    It's indices not indexes :)

    • @VivekTiwari03
      @VivekTiwari03 5 ปีที่แล้ว +5

      Look the grammer nazis are here.

  • @pawlack
    @pawlack 5 ปีที่แล้ว

    #hey, why this works:
    def PurgeGameMap():
    for x in range(len(game)):
    for y in range(len(game[x])):
    game[x][y] = E
    #and this doesnt?
    def PurgeGameMap():
    for x in game:
    for y in game[x]:
    game[x][y] = E

  • @vbaku9766
    @vbaku9766 6 ปีที่แล้ว

    This video was unexpected 😅

  • @spy6924
    @spy6924 4 ปีที่แล้ว +1

    U have Discord?

  • @glorytoarstotzka330
    @glorytoarstotzka330 6 ปีที่แล้ว +3

    sentdex sent me to watch this

    • @sentdex
      @sentdex  6 ปีที่แล้ว +6

      Sentdex welcomes you to this.

  • @thomasbiju4972
    @thomasbiju4972 4 ปีที่แล้ว

    hey bro copy paste the code in description pls

  • @woahart7476
    @woahart7476 4 ปีที่แล้ว

    Lmao how do i access that party button?

  • @csalamalekym
    @csalamalekym 4 ปีที่แล้ว

    3 am rip

  • @davelowinger7056
    @davelowinger7056 4 ปีที่แล้ว

    4 dim. tik tac toe?