How can I bring solve this by bringing the numbers and dots closer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I bring solve this by bringing the numbers and dots closer?

How can I bring solve this by bringing the numbers and dots closer? https://code.sololearn.com/c39DBRP50HNZ/?ref=app

6th Sep 2021, 6:16 AM
DN Josh
DN Josh - avatar
10 Answers
+ 3
Also have a look at f-strings: print(f"{i}.") They are a more modern way of formatting :)
6th Sep 2021, 6:31 AM
Lisa
Lisa - avatar
+ 1
Please tag the relevant programming language. Is it a code project? Which task is it exactly? Which course is it? Please show your code!
6th Sep 2021, 6:20 AM
Lisa
Lisa - avatar
+ 1
DN Josh Those curly brackets are whats called placeholders, we can fill the place holders with the .format() method,and enter in values based on the curly bracket positions,seperated with commas.
6th Sep 2021, 6:28 AM
raynard
raynard - avatar
0
Lisa check up there 👆👆
6th Sep 2021, 6:21 AM
DN Josh
DN Josh - avatar
0
You could use the sep- argument of print and put it print(..., sep="")
6th Sep 2021, 6:23 AM
Lisa
Lisa - avatar
0
DN Josh Do a string formatting print("{}{}".format(i,"."))
6th Sep 2021, 6:24 AM
raynard
raynard - avatar
0
edit the code and check if it works
6th Sep 2021, 6:24 AM
DN Josh
DN Josh - avatar
0
raynard works perfectly
6th Sep 2021, 6:25 AM
DN Josh
DN Josh - avatar
0
What is the function of the two curly brackets?
6th Sep 2021, 6:26 AM
DN Josh
DN Josh - avatar
0
Lisa this is the simplest way of doing it. I ❤️this idea
6th Sep 2021, 6:33 AM
DN Josh
DN Josh - avatar