Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
For loops in python
#1
Hey guys! So, I am a new person to these forums, and I am learning python right now. Currently, I'm learning about for loops, but I'm not super sure on how exactly they work. Here's an example of some code from the course I'm taking:

list = [5, 2, 1, 4, 9, 10]
min_value = 0
for item in list:
    if item < min_value:
        min_value = item
print(min_value)


What I'm unsure about is how exactly they got "item" in line 3. Can someone help me out and explain it a bit clearly for me please? Thanks!
Reply


Messages In This Thread
For loops in python - by Boinbo - Apr-17-2020, 11:27 PM
RE: For loops in python - by micseydel - Apr-17-2020, 11:33 PM
RE: For loops in python - by Boinbo - Apr-17-2020, 11:35 PM
RE: For loops in python - by buran - Apr-18-2020, 01:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why both loops don't work in python? nau 3 1,158 Sep-21-2022, 02:17 PM
Last Post: rob101
  Why does Python not use parenthesis to contain loops? davidorlow 3 3,534 Jun-09-2021, 06:33 AM
Last Post: Gribouillis
  Python for loops Kristenl2784 3 55,816 Jun-16-2020, 06:01 PM
Last Post: Yoriz
  For loops help, using python turtle SemiBeginnerPY 2 4,047 Mar-10-2020, 10:46 AM
Last Post: SemiBeginnerPY

Forum Jump:

User Panel Messages

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