• Register
0 votes
36 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,060 points

Please log in or register to answer this question.

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,950 points

Related questions

0 votes
2 answers 427 views
427 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 72 views
72 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, 2020 LizzyM 6.1k points
0 votes
1 answer 9 views
9 views asked Oct 22, 2020 Shaad Sh 800 points
0 votes
1 answer 8 views
8 views asked Oct 22, 2020 Shaad Sh 800 points
0 votes
1 answer 80 views
80 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, 2020 Ahsan 1.8k points
0 votes
1 answer 14 views
14 views
Problem: Hi, I know I am asking a silly question but how do you print in the next line in python?
asked Oct 8, 2020 Ahsan 1.8k points
0 votes
1 answer 18 views
1 vote
1 answer 53 views
53 views
I am trying to write a script to print specific words after a particular string. Here is the input file Theyare "playing in the ground", with friends Theyare "going to Paris", with family Theyare "motivating to learn new things", by themselves In the output I am trying to select "are" as the keyword ... open ('input.txt', 'r') as f: for lines in f: a = re.search(r'\bare', f): if a: print (lines)
asked Jul 15, 2020 anonymous
0 votes
1 answer 25 views
25 views
Problem: In C++, \n is used in various conditions, but what do I use in Python I am a bit confused? I don't want to have to use: print (" "). This doesn't seem a very good way to implement. Any help will be great!
asked Jun 3, 2020 Gavin 15.3k points
1 vote
1 answer 45 views
45 views
Probelm: I have 4 values that are: a = 9 b = 13.58 c = "allforallinall" d = [9, 13, 99] For those four values I tried to print which type of a variable they are, So I wrote this python program: a = 9 b = 13.58 c = "allforallinall" d = [9, 13, ... If this is not the way to print the type of a variable which is and how to print the type of a variable using a python program. Thanks in advance.
asked May 17, 2020 samhaz 5k points