Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Printing a new python list
#1
list = 100
if list > 99:
print(list=list(range(100,500))



why wont this work? can you help fix this?
Reply
#2
list = 100

is not a list

list = [98, 99, 100, 101]

is a list

if you want to make a list from 100 to 500

list = []
for x in range(100, 501):
    list.append(str(x))

print("\n".join(list))
Reply
#3
oh snap. thank you. im still learning!
Reply
#4
don't use list as variable name, it's build-in function...
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Printing through list.. again jesse68 2 1,147 Apr-16-2022, 03:24 PM
Last Post: jesse68
  help for list printing jip31 8 3,639 May-01-2021, 03:52 AM
Last Post: Pedroski55
  Problem printing last element from a list tester_V 3 2,410 Oct-30-2020, 04:54 AM
Last Post: tester_V
  Printing empty list? hhydration 2 2,126 Oct-28-2020, 11:34 AM
Last Post: Atekka
  Printing images from a list Heyjoe 4 2,830 Jun-22-2020, 02:28 AM
Last Post: Heyjoe
  printing a list contents without brackets in a print statement paracelx 1 2,136 Feb-15-2020, 02:15 AM
Last Post: Larz60+
  Printing List in one line bharat_s579 6 4,135 May-26-2019, 08:30 PM
Last Post: perfringo
  list is printing incorrectly.. anna 1 2,095 May-18-2019, 12:12 PM
Last Post: ichabod801
  Printing one thing from a list bidoofis 1 2,343 Feb-05-2019, 09:02 PM
Last Post: ichabod801
  [Help] List of Lists not printing both Cmder/Anaconda? vanicci 4 3,573 Aug-15-2018, 03:00 PM
Last Post: vanicci

Forum Jump:

User Panel Messages

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