r/learnpython • u/SavingsOdd2766 • 20m ago
My first complete comand in Python, from my first day on:
Look:
import random
import time
def drawn(a, b):
return random.randint(a, b)
answer = 'yes'
while answer == 'yes':
a = int(input('Min number: '))
b = int(input('Max number: '))
print(f'Drawn: {drawn(a, b)}')
time.sleep(2)
answer = input('Try again? ').lower()This creates a random number generator where you can choose the minimum and maximum numbers!
6
Upvotes
•
u/fazzah PyQt | SQLAlchemy | ReportLab 11m ago
good. now find a way to protect the script if someone inputs "foo"
•
u/Blinkinlincoln 13m ago
Nice