Skip to content

Instantly share code, notes, and snippets.

@oguzcan-yavuz
Last active November 1, 2017 06:51
Show Gist options
  • Save oguzcan-yavuz/d37a26f070c3a71addece4e3b8f8d197 to your computer and use it in GitHub Desktop.
Save oguzcan-yavuz/d37a26f070c3a71addece4e3b8f8d197 to your computer and use it in GitHub Desktop.
gecen seneden bir sonraki senenin vizesinin cozumleri
# 1
def random_yuz_sayi():
import random
a, b = [], []
[(a if i % 2 == 0 else b).append(i) for i in random.sample(xrange(0, 500), 100)]
print("A listesindeki elemanlar toplami: %d" % (sum(a)))
print("B listesindeki elemanlar toplami: %d" % (sum(b)))
random_yuz_sayi()
# 2
bilgiler = {}
bilgiler["meslek"] = raw_input("Meslek\n")
bilgiler["adres"] = raw_input("adres\n")
bilgiler["isim"] = raw_input("isim\n")
bilgiler["tel"] = raw_input("tel\n")
bilgiler["soyisim"] = raw_input("soyisim\n")
for key, value in bilgiler.items():
print("%s: %s" % (key, value))
# 3
zLinux = ["Ubuntu", "Debian", "SuSe", "NepaLinux", "Fedora", "PCLinuxOS", "Skolelinux", "RxArt"]
zLinux.sort(key=lambda n: len(n))
for i, item in enumerate(zLinux):
print("%d- %s" % (i, ((10 - len(item)) * "#") + item))
# 4
def elemanlari_takasla(liste):
if len(liste) % 2 != 0:
liste.append("x")
length = len(liste) - 1
for i in range(0, length, 2):
liste[i], liste[i + 1] = liste[i + 1], liste[i]
return str(liste)
cumle = raw_input("Bir cumle giriniz\n")
for i in set(cumle):
print(i)
print(elemanlari_takasla(list(cumle)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment