Reputation: 11
So I have the data to output like this for example progress 1: *
progress-moduletrailer 4: ****
do_not_progress 6:******
exclude 2: **
But I would want it to show it like this
progress
2:
**
etc
I would appreciate any help with this, very stuck.
print("Progress",Progress, ":", end= " ")
for i in range (Progress):
print("*", end = " ")
print("\n")
print("Progress_module_trailer",Progress_module_trailer, ":", end= " ")
for i in range (Progress_module_trailer):
print("*", end = " ")
print("\n")
print("Do_not_progress_module_trailer",Do_not_progress_module_trailer, ":", end= " ")
for i in range (Do_not_progress_module_trailer):
print("*", end = " ")
print("\n")
print("Exclude",Exclude, ":", end= " ")
for i in range (Exclude):
print("*", end = " ")
print("\n")
print(Progress+Progress_module_trailer+Do_not_progress_module_trailer+Exclude,"Number of students in total")
Upvotes: 1
Views: 170
Reputation: 373
If I understood it correctly a \n
between progress, the number and the stars should do the trick!
The \n means that a new line is started.
Example:
print(Hello world)
Prints out:
Hello world
but
print(Hello\nworld)
Prints out:
Hello
World
Upvotes: 1
Reputation: 12168
Try defining the separator argument of the print function and using an f-string
format as such:
print("Progress", f"{Progress}:", sep='\n'))
FYI: The default separator is a single space, changing it to a new line (or 2 new lines if you so wish) can be done through each function call.
Upvotes: 1