Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Week03_Hw4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

## 4-unique_list.py
##Write a function that filters all the unique(unrepeated) elements of a given list.



def unique(list):

unique_list = []

for x in list:

if x not in unique_list:
unique_list.append(x)

for x in unique_list:
print(x)

list = [1,2,3,3,3,3,4,5,5]

print(unique(list))


13 changes: 13 additions & 0 deletions Week03_Hw5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# function which return reverse of a string

def return_reserve(x):
return x == x[::-1]

x = input("check your word reserve or not, please enter your word : ")
y = return_reserve(x)

if y:
print("Yes")
else:
print("No")
10 changes: 10 additions & 0 deletions Week03_Hw_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
##Write a function that finds perfect numbers between `1` and `1000`.
##Check perfect numbers between `1` and `1000` and find the sum of the perfect numbers using reduce and filter functions.

def perfect(x):
return [y for y in range(1, int(x / 2) + 1) if x % y == 0]

def perfect_numbers_in_range(a,b):
return [x for x in range(a,b+1) if sum(perfect(x)) == x]

print(perfect_numbers_in_range(1, 10000))
15 changes: 15 additions & 0 deletions Week03_Hw_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

#write a function that outputs the transcription of an input number with two digits.


def transcription(n):

units_digits=['','one','two','tree','four','five','six','seven','eight','nine']
tens_digits=['','','twenty','thirty','fourty','fifty','sixty','seventy','eighty','ninety']
units=n%10
tens=n//10
print(tens_digits[tens],units_digits[units])

number=int(input("enter number with two digits : "))
transcription(number)

10 changes: 10 additions & 0 deletions Week03_Hw_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def abccc():

items=[i for i in input().split('-')]
items.sort()

#print('-'.join(abccc))

print(abccc)