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
9 changes: 9 additions & 0 deletions alphabetical_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##3-alphabetical_order.py

def words ():
x, y, z, w = input("please enter four word:").split("-")
list=[x, y, z, w]
list.sort()
for i in list:
print(i,end="-")
print(words())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cok guzel fakat fonksiyonu cagrisini print fonksiyonu icinde yazdiginiz icin none degeri yazdiriyor ensonda. son satir sadece: words() yeterli. Ancak bu seferde son kelimenin sonuna - isareti yazar. onuda biraz daha dusunseniz temizlenir. mesela for loop icine if i==list[-1]: gibi bir sart koyarak yada baska yollar bulunabilir

10 changes: 10 additions & 0 deletions equal_reverse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
##5-equal_reverse.py

def isPalindrome(s):
return s == s[::-1]
s = input("enter a word :")
ans = isPalindrome(s)
if ans:
print("true")
else:
print("false")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temiz ve kisa cozum tebrikler

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

def perfect ():
perfectlist=[]
for i in range (1,1000):
sum=0
for j in range (1,i):
if i%j==0:
sum +=j # sum all divisor
if sum == i: # if sum of divisor equal to number it means number is perfect
perfectlist.append(i)
return print(perfectlist)
print(perfect())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tebrikler. sadece 1- fonksiyon cagrisini print icinde yapmayin. none ciktisi veriyor buyuzden son satirda.
2- yorum satirlari eklenebilir. # kullanarak

19 changes: 19 additions & 0 deletions reading_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
##2-reading_number.py

def read ():
number = int(input("please enter a number:"))
ones=["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
tens=["", "teen", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety"]
one = number%10 # we find ones digit
ten = number//10 #we find tens digit
if ten == 1 and one == 1: # for 11
return print("eleven")
elif ten ==1 and one == 2: # for 12
return print("twelve")
elif ten ==1 and one == 3: # for 13
return print("thirteen")
elif ten==1 and one != 1 and one !=2 and one != 3: # without 10+(1, 2, 3) ; 14,15...
return print(ones[one], "teen")
else:
return print(tens[ten], ones[one]) # write without {} + teen. it is 20,21,22,...
print(read())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yorum satirlari eklenebilir.
fonksiyon cagrisi read() seklinde olmali print() e gerek yok

8 changes: 8 additions & 0 deletions unique_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##4-unique_list.py
# Write a function that filters all the unique(unrepeated) elements of a given list.

def unique_list(test_list):
res = []
[res.append(x) for x in test_list if x not in res]
return res
print (unique_list([1, 1, 1, 2, 2, 3, 3]))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tebrikler. yorum satiri ve fonksiyon cagrisi daha iyi olabilir