V
V
verschwendet2018-10-02 15:59:37
Python
verschwendet, 2018-10-02 15:59:37

How to remove the last (exactly her) comma in a line?

wherein:

a = int(input("Введите число: "))
b = int(input("Введите число: "))

for i in range(a, b+1):
    print("{}, ".format(i), end = "")

it displays numbers like this:
1, 2, 3, 4, 5,

how to remove this comma after the final number??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Pugachev, 2018-10-02
@Stqs

RTFM
",".join([str(i) for i in range(a, b+1)])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question