The task is to have something like this is as the output:
Progress Trailing Retriever Excluded
* * *
*
Here is my attempt:
input:
print("Progress")
x = 0
while x<5:
print(' *')
x+=1
output:
Progress
*
*
*
*
*
input:
#for next heading
print("Trailing")
x = 0
while x<2:
print(' *')
x+=1
output:
Trailing
*
*
Thanks in advance, I've been trying to find a way for a long time.
Change
print("Trailing")
To
print("Trailing", end='')
And you will not print the default \\n
character at the end of the string.
There are ways to move the cursor in a terminal to do it in the way you are probably thinking of but the simplist way is just to print it a line at a time (pseudocode):
print('Progress Trailing Retriever Excluded')
for entry in entries:
print(' * ' if entry.progress else ' ', end='')
print(' * ' if entry.trailing else ' ', end='')
print(' * ' if entry.retriever else ' ', end='')
print(' * ' if entry.excluded else ' ') # No end here to add newline
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.