View ex18.py
# -*- coding: utf-8 -*-
#Excercise 18: Cows and Bulls Game
'''
This is the given example for what the __main__ method does:
def square(num):
return num * num
if __name__=="__main__":
user_num = input("Give me a number: ")
View gist:62f943075285e1fedd7812ed48425746
import random
def new():
x = random.randint(1,9)
return x
def game(x,n,y):
while True:
g = (input("guess: "))
if g == "exit":
print("game over.")
View gist:ecc569963d6f8f517a176370ec643bbf
# -*- coding: utf-8 -*-
b = int(input("please enter an integer:\n"))
print ("The divisors for " + str(b) + " are: ")
for i in range(1,b+1):
if b%i==0:
print(i)
x = [i for i in range(1,b+1) if b%i==0]
print("here is a list of your divisors for " + str(b) + ":\n" + str(x))