How to show multiple lines on an output line (output)?

Asked

Viewed 14 times

0

I study in the course of Computer Science. I made a simple encryption using Caesar’s Cipher. I managed to encode, but I have a problem that is that my program shows several lines in output, which I did not want this.

For example my encryption: 0123456789 -> 7890123456, but my program shows so:

Output
7
8
9
0
1
...

But I wanted you to show me how:

Output
7890123456

How do I make my program show a result on an output line?

My show:

#num = str(input())
num = "0123456789"
n_com_espaço = " ".join(num)
n_separado = n_com_espaço.split(" ")
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 = n_separado
nr = 0
for i in range(0,10):
    nr = nr + 1
    r = "a"+str(nr)
    x = globals()[r]
    if (x == "0" or x == "1" or x == "2"):
        cal = int(x) - 3
        num_result_1 = cal%10
        print(num_result_1)
    else:
        num_result_1 = int(x) - 3
        print(num_result_1)
  • 1

    Exchange your print for print(num_result_1, end='')

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.