+ 1

Hello everyone! I have problem on phyton. Problem is in the end of output there is free space. Who can help me to remove it.

Phyton problem

10th Aug 2021, 2:11 PM
Sardorbek Karimov
Sardorbek Karimov - avatar
14 Réponses
+ 7
Sardorbek Karimov , are you sure that the space is at the end of the printed output? i can't find this there, but at the end of the first line there is a space. this is the raw string that is sent to the output: '* \n**\n***\n****'
10th Aug 2021, 3:03 PM
Lothar
Lothar - avatar
+ 4
Hi Sardorbek! Always remember to share your code with the community to solve your problem easily. Otherwise, it's kinda hard to guess what you're trying to achieve. Most probably, you're adding an additional space between quotes(") and the last character of your output variable. You can remove that space if my statement is correct.
10th Aug 2021, 2:19 PM
Python Learner
Python Learner - avatar
+ 4
Sardorbek Karimov Please post your code here
10th Aug 2021, 2:27 PM
Calvin Thomas
Calvin Thomas - avatar
+ 3
print("""* ** *** ****""") We're getting its output like this * ** *** **** But, what you're trying to print? You want to print an (") in your output?
10th Aug 2021, 3:32 PM
Python Learner
Python Learner - avatar
+ 3
Calvin Thomas thanks 👍🏻👍🏻it works. But I don't learn about if range in like this code. So I have problem😅.
10th Aug 2021, 5:08 PM
Sardorbek Karimov
Sardorbek Karimov - avatar
+ 3
Sardorbek Karimov How about this? :- i = 1 while i < 5: print("*" * i) i += 1 # Hope this helps
10th Aug 2021, 5:11 PM
Calvin Thomas
Calvin Thomas - avatar
+ 3
Calvin Thomas while did not work but if good one👍🏻
10th Aug 2021, 5:31 PM
Sardorbek Karimov
Sardorbek Karimov - avatar
+ 2
JUMP_LINK__&&__Python__&&__JUMP_LINK Learner Calvin Thomas this is code print("""* ** *** ****"""); There is free space in the end of output
10th Aug 2021, 2:51 PM
Sardorbek Karimov
Sardorbek Karimov - avatar
+ 2
JUMP_LINK__&&__Python__&&__JUMP_LINK Learner I want to take output like this * ** *** **** No free space in this place
10th Aug 2021, 5:01 PM
Sardorbek Karimov
Sardorbek Karimov - avatar
+ 2
Lothar I am sure. Also JUMP_LINK__&&__Python__&&__JUMP_LINK Learner have the same output like me
10th Aug 2021, 5:04 PM
Sardorbek Karimov
Sardorbek Karimov - avatar
+ 2
for i in range(1, 5): print("*" * i) # Hope this helps
10th Aug 2021, 5:04 PM
Calvin Thomas
Calvin Thomas - avatar
+ 2
10th Aug 2021, 5:33 PM
Calvin Thomas
Calvin Thomas - avatar
+ 2
Calvin Thomas ok no problem👌
10th Aug 2021, 5:40 PM
Sardorbek Karimov
Sardorbek Karimov - avatar
- 2
🤟
11th Aug 2021, 5:31 PM
Katia Butenko.
Katia Butenko. - avatar