0

What's wrong in my syntax?

print("what do you wish us to perform?" \n "1." + a + "-" + b + "OR" \n "2." + b + "-" + a I want the following output =》 What do you wish us to perform ? 1.a-b OR 2.b-a

18th Dec 2016, 4:09 AM
‎‏‪‏‪Tarami Nishan‬‏‬‏‎
‎‏‪‏‪Tarami Nishan‬‏‬‏‎ - avatar
5 Answers
+ 2
actually, you should simplify: print("""What do you wish us to perform ? 1.a-b OR 2.b-a"""
18th Dec 2016, 6:03 AM
Frédéric Charette
Frédéric Charette - avatar
+ 2
in that case: print("what do you wish us to perform?\n1. " + a + "-" + b + "OR \n2. " + b + "-" + a)
18th Dec 2016, 3:30 PM
Frédéric Charette
Frédéric Charette - avatar
+ 1
should include single quotes to display characters ('a'),use double quotes and + operator appropriately . print("what do you wish us to perform? \n"+ "1." + 'a' + "-" + 'b' + " OR \n"+ "2." + 'b' + "-" + 'a');
18th Dec 2016, 4:22 AM
Doolitha Samaranayake
Doolitha Samaranayake - avatar
+ 1
i wanted to display the character held by "a" and "b" so tried to do in that format anyway thanks Frederic :)
18th Dec 2016, 10:56 AM
‎‏‪‏‪Tarami Nishan‬‏‬‏‎
‎‏‪‏‪Tarami Nishan‬‏‬‏‎ - avatar
+ 1
okay i shall try it Doc. Thank you for your help :)
18th Dec 2016, 10:57 AM
‎‏‪‏‪Tarami Nishan‬‏‬‏‎
‎‏‪‏‪Tarami Nishan‬‏‬‏‎ - avatar