Python Forum
Super newbie trying to understand certain concepts
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Super newbie trying to understand certain concepts
#1
I am trying to understand the concept of what output this bit of code produces and why...

1st = [1, 2, 3]
for v in range(len(1st)):
    1st.insert(1, 1st[v])
print(1st)

I know this is child's play to most of you and I'm kind of embarrassed to even be asking this but I just don't understand why, if letters like "i" or "v" aren't predefined keywords...and they haven't been assigned values in this piece of code... how am I supposed to be able to know the answer to what will be the printed result?
Reply


Messages In This Thread
Super newbie trying to understand certain concepts - by bbragg311 - Oct-27-2019, 04:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems with super() Hoespilaar 2 335 Apr-10-2024, 10:10 AM
Last Post: Hoespilaar
  super() in class akbarza 1 509 Dec-19-2023, 12:55 PM
Last Post: menator01
  super newbie question: escape character tsavoSG 3 2,531 Jan-13-2021, 04:31 AM
Last Post: tsavoSG
  superclass and super() grkiran2011 1 1,779 Jun-20-2020, 04:37 AM
Last Post: deanhystad
  MRO About super() catlessness 1 2,088 Jan-12-2020, 07:54 AM
Last Post: Gribouillis
  Super with Sublime Text - TypeError: super() takes at least 1 argument (0 given) Shafla 6 7,547 May-04-2019, 08:30 PM
Last Post: Shafla
  Is any super keyword like java rajeev1729 2 3,359 Sep-14-2017, 07:47 PM
Last Post: snippsat
  Multiple Inheritance using super() Sagar 2 7,347 Sep-08-2017, 08:58 AM
Last Post: Sagar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020