x = int(input("Choose the number of times you want to spam. ")) y = input("What message do you want to spam? ") w = x + 1 for i in range(1,w): print(y)
Any way to make this program better? I'm currently learning Python.
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It only takes a minute to sign up.Sign up to join this community
range(1, w)- get used to using zero-based numbering
_as the name for a loop variable when you won't actually be referring to that variable anywhere.
def main(): number_of_times = int(input("Choose the number of times you want to spam. ")) message = input("What message do you want to spam? ") for _ in range(number_of_times): print(message)
print((message + '\n') * number_of_times)