This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
def divisors(x): | |
lista=range(1,x+1) | |
listb=[] | |
for i in lista: | |
if x % i == 0: | |
listb.append(i) | |
return listb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
a = [1,2,3,4,3,2,1,2,3,4,5,6,7,9,8,7,6,7,8] | |
def contador(a, x): | |
b = [] | |
for i in a: | |
if i <= x: | |
b.append(i) | |
return b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Code for exercise 002 | |
#-*- coding: utf-8 -*- | |
pattern = 2 | |
print("Par o impar\n---------") | |
number = int(input("Ingrese un número: ")) | |
message = "par" if (number % pattern == 0) else "impar" | |
pattern = 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
factor = 100 | |
def calculate(age, factor): | |
return age + factor | |
if __name__ == "__main__": | |
name = raw_input("ingresa tu nombre: ") | |
age = int(input("ingresa tu edad: ")) |