Python Forum
Why does function print require bracket for text?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does function print require bracket for text?
#1
Hello,
I've just started to learn Python from the book "Python from beginning" Peter Norton.
In chapter 1 I learnt about using function print and it uses quatation marks for text but I try to do it practically I get an error that function print require brackets.
I use Python IDE editor version 3.6
Reply
#2
(May-23-2018, 05:34 PM)richardm55 Wrote: I get an error that function print require brackets.

What version of python is the book written for? In python 2.x, print "some words" was valid, but in python 3.x that is now a syntax error, and should be written as print("some words")
Reply
#3
just to add that you should stick to python 3.6 and [maybe] find a book that is not targeted at python2
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
  print doesnt work in a function ony 2 233 Mar-11-2024, 12:42 PM
Last Post: Pedroski55
  Why doesn't list require global keyword? johnywhy 9 653 Jan-15-2024, 11:47 PM
Last Post: sgrey
  Start print a text after open an async task via button Nietzsche 0 671 May-15-2023, 06:52 AM
Last Post: Nietzsche
  Grouping Data based on 30% bracket purnima1 4 1,142 Mar-10-2023, 07:38 PM
Last Post: deanhystad
  How to print variables in function? samuelbachorik 3 852 Dec-31-2022, 11:12 PM
Last Post: stevendaprano
  Saving the print result in a text file Calli 8 1,700 Sep-25-2022, 06:38 PM
Last Post: snippsat
  How to print the output of a defined function bshoushtarian 4 1,237 Sep-08-2022, 01:44 PM
Last Post: deanhystad
  Writing into 2 text files from the same function paul18fr 4 1,629 Jul-28-2022, 04:34 AM
Last Post: ndc85430
  Print text with big font and style tomtom 5 13,776 Mar-03-2022, 01:29 AM
Last Post: tomtom
  Why does absence of print command outputs quotes in function? Mark17 2 1,342 Jan-04-2022, 07:08 PM
Last Post: ndc85430

Forum Jump:

User Panel Messages

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