Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
While loop in list
#1
Hello!

I'am currently taking a programming course in school and we have a project that is individual and we can't ask our teacher for help but we can ask on forums, so i came here looking for help.

My Task is to make 3 lists listing all even numbers between 50 and 100 using 3 different ways of making a list using conditions. I'm currently stuck with a problem regarding my while loop and i can't figure out why it won't append the numbers in a list.

Here is my code:

my_list = []
number_1=50
while True:
    my_list.append(number_1)
    number_1 = number_1+2
    if number_1== 100:
        break
    print(number_1)
Reply


Messages In This Thread
While loop in list - by TheGhostKnight - Nov-08-2019, 12:38 PM
RE: While loop in list - by perfringo - Nov-08-2019, 01:02 PM
RE: While loop in list - by ichabod801 - Nov-08-2019, 01:59 PM

Forum Jump:

User Panel Messages

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