vendredi 28 juin 2019

How to add random numbers together. Python

number_checker = 0

for random_variables in range(1,11):  
    import random  
    random = random.randint(1,25)  
    print(random)  
    if random % 2 == 0:  
        print("This number is even")  
        even_numbers = number_checker + random  
    else:  
        print("This number is odd")  
        odd_numbers = number_checker + random    

print("")  
print("This is the sum of even numbers.")  
print(even_numbers)  
print("")  
print("This is the sum of odd numbers.")  
print(odd_numbers)  

Sorry about the formatting this is my first time using Stack Overflow.




Aucun commentaire:

Enregistrer un commentaire