Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help for use print in REPL
#5
Hi Jip31,
Although it is right what Perfringo said, for the purpose of studying: what your code gives me is the following:
Error:
File "forum03.py", line 3 print a[x] ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(a[x])?
print a[x] is old Python 2 syntax. In Python 3 "print()" is a function. When you correct this:
a = [1, 2, 3, 4, 5]
for x in range(len(a)):
    print(a[x])
... the result is:
Output:
1 2 3 4 5
Reply


Messages In This Thread
help for use print in REPL - by jip31 - Apr-29-2021, 09:18 AM
RE: help for use print in REPL - by DPaul - Apr-29-2021, 09:18 AM
RE: help for use print in REPL - by jip31 - Apr-29-2021, 09:21 AM
RE: help for use print in REPL - by perfringo - Apr-29-2021, 10:00 AM
RE: help for use print in REPL - by ibreeden - Apr-29-2021, 10:45 AM
RE: help for use print in REPL - by jip31 - Apr-29-2021, 11:17 AM
RE: help for use print in REPL - by jefsummers - Apr-29-2021, 11:51 AM
RE: help for use print in REPL - by deanhystad - Apr-29-2021, 01:13 PM
RE: help for use print in REPL - by bernardand - Apr-30-2021, 02:19 PM
RE: help for use print in REPL - by bowlofred - Apr-30-2021, 03:52 PM
RE: help for use print in REPL - by ndc85430 - Apr-30-2021, 02:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using my REPL to bisect numbers and lists with classes (PyBite #181) Drone4four 2 2,090 Sep-24-2020, 01:47 PM
Last Post: Drone4four
  Using matplotlib in Spyder v/s REPL peterjv26 2 2,600 Jul-04-2020, 10:57 AM
Last Post: snippsat
  Online python repl? Gribouillis 4 45,131 Apr-09-2020, 12:19 PM
Last Post: Gribouillis
  REPL grkiran2011 1 2,147 Jan-08-2020, 11:47 PM
Last Post: Gribouillis
  Embedding or adding IDE like "repl" inside Flask app sray 1 2,250 Jul-03-2019, 03:13 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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