remove ( ', from python output

Skip to first unread message

Alakh Niranjan

Nov 9, 2020, 10:29:21 AM11/9/20
to Skulpt
HI Sir/Ma'am

I am using Skulpt Library, in my project . but we find

in input 
a = 540
b = 790
sum = a+b
print("sum of two is", sum)

('sum of two is ', 1330).

whenever output should be.
sum of two is 1330.

How can solve that issue.Please guide me


Michael Cimino

Nov 11, 2020, 12:22:44 PM11/11/20
to Skulpt
Hello Alakh,

Try using python 2 syntax (no parentheses) for the print statement, like this:
print "sum of two is", sum

If you need to keep the python 3 syntax of using parentheses, other solutions are:

* use str to convert the variable into a string, and +  to concatenate the two strings
print("sum of two is" + " "+str(sum))

* use joinstr, and a list comprehension to combine the elements
print(" ".join([str(x) for x in ("sum of two is", sum)]))

I hope that helps. 

Best Regards,

Reply all
Reply to author
0 new messages