← Back to Community
Sorry
Profile icon
FARHEENPALAGIRI

Hi. I'm sorry, I ran into a problem. Just one quick question: I want the answer of two different equations in one sentence(sentence? idk). I tried this:

print (x * y) and print(z*y)
(x, y and z are all input values)

But all I got was a syntax error.
Please help

Voters
Profile icon
FARHEENPALAGIRI
Comments
hotnewtop
Profile icon
freddyamarsden

Theres no need to say sorry.

Profile icon
pyelias

To solve this problem, I'd check the documentation for print.
It says:

print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
Print objects to the text stream file, separated by sep and followed by end...

The * before objects means that there can be multiple objects printed. So, you would use print(x * y, z * y) to print both things in one line.

Profile icon
FARHEENPALAGIRI

@pyelias Thanks a lot :)

Profile icon
JosephBarroso

Can you post your code? It'd be easier to find what the problem was if I can see the code :)

Profile icon
FARHEENPALAGIRI
Profile icon
FARHEENPALAGIRI

@JosephBarroso

d = int(input())

c = int(input())

ca = int(input())

print(d * ca) and print(c * ca)

Profile icon
John_WardWard

@FARHEENPALAGIRI Please link a repl:) .

Profile icon
AzureScripts

@FARHEENPALAGIRI print(d, ca) print(c, ca)

Profile icon
LynnOng

@FARHEENPALAGIRI

Try This:

d = int(input())

c = int(input())

ca = int(input())

print(str(d)+str(ca)) and print(str(c)+str(ca))

I can't give you any more than that. I'll need to know more about the code and what you're trying to do.
Hope this helps.