• Register
0 votes
27 views

I am new to pyhton programming . I was doing some coding practice. I wrote a code:

def addition(a , b):
  return a + b
def delete(a, b):
  return a - b

choice = int(input("Please enter your Choice: "))
print 1.For addition 
print 2.For delete  

but it gives me some error like:

 File "main.py", line 7
    print 1.For addition
          ^
SyntaxError

waht is the problem with my code can anyone help?

10 7 2
6,050 points

1 Answer

–1 vote

In python if you use

print something

It will not work. If you want to print somthing you should write:

print("something")

So you should write your code like:

def addition(a , b):
  return a + b
def delete(a, b):
  return a - b

choice = int(input("Please enter your Choice: "))
print ("1.For addition")
print ("2.For delete") 

 

11 6 4
34,930 points

Related questions

0 votes
2 answers 272 views
272 views
Problem : When I try to use a print statement in Python, it gives me below error: SyntaxError: Missing parentheses in call to 'print'
asked Oct 22, 2019 peterlaw 6.9k points
1 vote
1 answer 48 views
48 views
Problem: I am a newbee in programmingand I am doing a online course on python. To follow that course I wrote a code: def add(x , y): return x + y def del(x, y): return x - y choice = int(input("Please enter your Choice: ")) print 1.For addition print ... error like: File "calc.py", line 7 print 1.For addition ^ SyntaxError: Missing parentheses in call to 'print' What should I do now please help
asked Apr 4 LizzyM 6.1k points
0 votes
1 answer 5 views
5 views asked 2 days ago Shaad Sh 800 points
0 votes
1 answer 5 views
5 views asked 2 days ago Shaad Sh 800 points
0 votes
1 answer 8 views
8 views
I need help with the basics, I need to print 1 to100 numbers in python. Please explain with the help of an example.
asked Oct 10 Ahsan 1.8k points