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
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] | |
b=[] | |
for i in a: | |
if i%2 == 0: | |
b.append(i) | |
print(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
a=[] | |
b=[] | |
length = int(input("how long is the list")) | |
for _ in range(length): | |
a.append(input("please input item into the list")) | |
b = (a[::-1]) | |
if a == b: | |
print("its a palindrome") |
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
import random | |
a = [] | |
b = [] | |
c=[] | |
p = random.randint(1,9) | |
for _ in range(p): | |
q = random.randint(0,9) | |
a.append(q) |
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
k = int(input("give me a number")) | |
a = [] | |
for divisor in range(1, k+1): | |
print(divisor) | |
if k%divisor == 0: | |
a.append(divisor) | |
print(a) |
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
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
b=[] | |
c=[] | |
number = int(input("gimme a number")) | |
for k in a: | |
if k<5: | |
b.append(k) | |
print(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
k = int(input("input a number")) | |
d = int(input("give me a number to devide")) | |
if k/d == 0 : | |
print("it has been divided evenly") | |
else: | |
print("it had not been divided evenly") | |
if k % 2 == 1: | |
print("it is an odd number") | |
elif k%4 == 0 and k > 4: | |
print("it is multiple of 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
name = input("name input") | |
age = input("age input") | |
iteration = input("iteration") | |
iteration = int(iteration) | |
age = int(age) | |
year = 100 - age | |
for _ in range(iteration): | |
print(name, "u will be 100 years old after ", year, " years", end="") |
NewerOlder