I'm trying to make a, "fake" loading bar as just a small task. I'm new to coding and this seems to work, but it seems a lot of code. I assume could be done in like 2 lines by someone with more skill than me. I would love to see how this could be refactored into a more efficient way. Any help would be greatly appreciated!
loading_bar = "LOADING\n[==========]"
print(loading_bar[0:10])
time.sleep(.300)
os.system('cls')
print(loading_bar[0:11])
time.sleep(.300)
os.system('cls')
print(loading_bar[0:12])
time.sleep(.300)
os.system('cls')
print(loading_bar[0:13])
time.sleep(.300)
os.system('cls')
print(loading_bar[0:14])
time.sleep(.300)
os.system('cls')
print(loading_bar[0:15])
time.sleep(.300)
os.system('cls')
print(loading_bar[0:16])
time.sleep(.300)
os.system('cls')
print(loading_bar[0:17])
time.sleep(.300)
os.system('cls')
print(loading_bar[0:18])
time.sleep(.300)
os.system('cls')
print(loading_bar)
I'm sorry if this isn't in the right place. I'm new to StackOverflow as well.