mardi 8 septembre 2020

How to sum random two numbers?

This is a tough question I got from my school for a beginner. The program asks to generate two random numbers between 1 to 10 and told to make the output of the sum in a separate function with two passed parameters. I managed to generate two random numbers but how to sum up that is a kinda new deal to me.

import random
randomlist = random.sample(range(1, 10), 2)
print randomlist 



Aucun commentaire:

Enregistrer un commentaire