
Martí Falcón Padró
PreguntaRepito:
Traceback (most recent call last):
File “C:\Users\Usuario\Documents\Platzi\Phyton\aleatorio.py”, line 22, in <module>
run()
File “C:\Users\Usuario\Documents\Platzi\Phyton\aleatorio.py”, line 7, in run
random_number = random.randint(0, 20)
AttributeError: ‘module’ object has no attribute ‘randint’
Process returned 1 (0x1) execution time : 0.064 s
Presione una tecla para continuar . . .
Y el programa está así:
<h1>-- coding: utf-8 --</h1> import random
def run():
number_found = False
random_number = random.randint(0, 20)
while not number_found: number = int(raw_input('Intenta un numero:')) if number == random_number: print('Felicidades. Encontraste el numero') number_found = True elif number > random_number: print('El numero es + peque') else: print('El numero es + grande')
if name == ‘main’:
run()

Danelia Sanchez Sanchez
En esta linea:
if name == ‘main’:
olvidaste colocar doble guión bajo:
if __name__ == '__main__':