1

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")
aminography
  • 21,986
  • 13
  • 70
  • 74

2 Answers2

1

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.

Yaakov Bressler
  • 9,056
  • 2
  • 45
  • 69
1

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
Adrian
  • 363
  • 3
  • 12