Ask coding questions

← Back to all posts
Sorry
FARHEENPALAGIRI (11)

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(zy)
(x, y and z are all input values)

But all I got was a syntax error.
Please help

Commentshotnewtop
freddyamarsden (23)

Theres no need to say sorry.

pyelias (1769)

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.

JosephBarroso (1)

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

FARHEENPALAGIRI (11)

@JosephBarroso

d = int(input())

c = int(input())

ca = int(input())

print(d ca) and print(c ca)

LynnOng (26)

@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.