Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.hafta-emrah #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
107 changes: 107 additions & 0 deletions 7. Hafta Tel Rehberi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
print("""
Tel Rehberi Programi

Yapmak İstediginiz İslemi Seciniz:

1- Rehbere kisi ekleme,
2- Rehberden kisi silme,
3- Rehberde kisi ismi guncelleme,
4- Rehberde tel no guncelleme,
5- Rehberi goruntuleme

Cikmak icin: q ya da Q


""")
rehber={"isim":"tel no"} #rehber olarak sozluk kullanildi.
print("Rehber: ",rehber)

while True:
secim=input("Lutfen seciminizi belirtiniz: ")
if secim=="q" or secim=="Q":
print("Sistemden Cikiliyor...")
quit()
elif secim=="1":
isim=input("Rehbere eklemek istediginiz ismi giriniz: ").upper() #Rehbere eklenen tum isimler buyuk harfle kayit ediliyor.
while True:
tel=input("Bu isme ait tel no'yu giriniz:06- ")
if len(tel)!=10:
print("10 haneli tel nonuzu giriniz...")
continue
else:
break
rehber[isim]=tel
print("Yeni kisi Rehbere eklendi.")

with open ( "Rehber.txt" , "w" ) as dosya : #Rehber isimli dosyaya kayit ediliyor.
for key,value in rehber.items():
kayit=f'{key} : {value} ''\n'
print(kayit)
dosya.write(kayit)


continue
elif secim=="2":
isim2=input("Rehberden silmek istediginiz ismi giriniz: ").upper()
while True:
if isim2=="":
print("Lutfen gecerli bir isim giriniz.")
break
elif not isim2 in rehber:
print("Bu isim zaten rehberde kayitli degil.")
break
else:
rehber.pop(isim2)
print(rehber)
with open ( "Rehber.txt" , "w" ) as dosya :
for key,value in rehber.items():
kayit=f'{key} : {value} ''\n'
print(kayit)
dosya.write(kayit)
break

elif secim=="3":
isim3=input("Ismini guncellemek istediginiz ismi yazin: ").upper()
if isim3=="":
print("Lutfen gecerli bir isim giriniz.")
elif not isim3 in rehber:
print("Bu isim zaten rehberde kayitli degil.")
break
else:
guncel_isim3=input("Yeni ismi giriniz: ").upper()
rehber[isim3]=guncel_isim3
print(rehber)
with open ( "Rehber.txt" , "w" ) as dosya :
for key,value in rehber.items():
kayit=f'{key} : {value} ''\n'
print(kayit)
dosya.write(kayit)
continue
elif secim=="4":
guncel_isim=input("Telefonunu guncellemek istediginiz ismi yazin: ").upper() #guncelleme yapmak icin var olan isimlerden secim yapilabilir
if guncel_isim=="":
print("Lutfen gecerli bir isim giriniz.")
elif not guncel_isim in rehber:
print("Bu isim zaten rehberde kayitli degil.")
break
else:
guncel_tel=input("Guncel numarayi giriniz: ")
rehber[guncel_isim]=guncel_tel
print(rehber)
with open ( "Rehber.txt" , "w" ) as dosya :
for key,value in rehber.items():
kayit=f'{key} : {value} ''\n'
print(kayit)
dosya.write(kayit)
continue
elif secim=="5":
if rehber=={}:
print("Rehberde kayitli kimse yok...")
break
else:
for key,value in rehber.items():
print(key,value)

else:
print("Hatali giris yaptiniz...","Tekrar deneyin...")
continue
77 changes: 77 additions & 0 deletions 7. hafta - sifreleme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#Sifreleme Odevi:
##Şifreleme Uygulaması
##Kullaniciya iki secenek sunarak orjinal metni sifreli metne ve
##sifreli metni orjinal metne donusturebilen bir program yazmanizi istiyoruz.
##Sozlukler yardimi ile bir sifreleme algoritmasi olusturun ve
##kullanicidan alacaginiz inputu bu algoritma yoluyla sifreleyin
##ve ekrana yazdirin. Kullanici daha sonra bu sifreli metni input
##olarak yazdiginda orjinal metne ulasabilsin.
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', 'N':'-.',
'O':'---', 'P':'.--.', 'Q':'--.-',
'R':'.-.', 'S':'...', 'T':'-',
'U':'..-', 'V':'...-', 'W':'.--',
'X':'-..-', 'Y':'-.--', 'Z':'--..',
'1':'.----', '2':'..---', '3':'...--',
'4':'....-', '5':'.....', '6':'-....',
'7':'--...', '8':'---..', '9':'----.',
'0':'-----', ', ':'--..--', '.':'.-.-.-',
'?':'..--..', '/':'-..-.', '-':'-....-',
'(':'-.--.', ')':'-.--.-'}
print("""
Mors Alfabesiyle
sifreleme ve desifreleme islemi
yapmak icin;

Hosgeldiniz!!!

1- Sifreleme
2- Desifreleme

3- Cikis

.

""")
while True:
secim = input("\nYapmak istediginiz islemi seciniz: ")

if secim =="3":
print("Cikiliyor...")
quit()

if secim == "1":
mesaj = input("Lutfen sifrelemek istediginiz kelimeyi giriniz: ").upper()
sifre = ""
for harf in mesaj:
if harf != " ":
sifre += MORSE_CODE_DICT[harf] + " "
else:
sifre += " "
print("\n",mesaj,"kelimesinin sifrelenmis hali: ",sifre)

if secim == "2":
mesaj = input("\nLutfen cozmek istediginiz sifreyi giriniz: ")
mesaj += " "
desifre = ""
mors_kar = ""

for harf in mesaj:
i = 0
if harf != " ":
mors_kar += harf
else:
i += 1
if i == 2:
desifre += " "
else:
desifre += list(MORSE_CODE_DICT.keys())[list(MORSE_CODE_DICT.values()).index(mors_kar)]
mors_kar = ""

print("\n",mesaj,"sifresinin desifre edilmis hali: ",desifre)