Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mustafamuratcoskun
GitHub Repository: mustafamuratcoskun/Sifirdan-Ileri-Seviyeye-Python-Programlama
Path: blob/master/Döngüler/Döngüler - Ödev ve Çözümleri/Programlama Ödevi Çözümleri - Döngüler.ipynb
765 views
Kernel: Python 3

Çözümler

Problem 1

sayı = int(input("Sayı:")) i = 1 toplam = 0 while (i < sayı): if (sayı % i == 0): toplam += i i += 1 if (toplam == sayı): print(sayı,"mükemmel bir sayıdır.") else: print(sayı,"mükemmel bir sayı değildir.")
Sayı:28 28 mükemmel bir sayıdır.

Problem 2

sayı = input("Sayı:") basamak_sayisi = len(sayı) sayı = int(sayı) basamak = 0 toplam = 0 gecici_sayı = sayı while (gecici_sayı > 0): basamak = gecici_sayı % 10 toplam += basamak ** basamak_sayisi gecici_sayı //= 10 if (toplam == sayı): print(sayı,"bir armstrong sayısıdır.") else: print(sayı,"bir armstrong sayısı değildir.")
Sayı:371 371 bir armstrong sayısıdır.

Problem 3

for i in range(1,11): print("*************************************************") for j in range(1,11): print("{} x {} = {}".format(i,j,i*j))
************************************************* 1 x 1 = 1 1 x 2 = 2 1 x 3 = 3 1 x 4 = 4 1 x 5 = 5 1 x 6 = 6 1 x 7 = 7 1 x 8 = 8 1 x 9 = 9 1 x 10 = 10 ************************************************* 2 x 1 = 2 2 x 2 = 4 2 x 3 = 6 2 x 4 = 8 2 x 5 = 10 2 x 6 = 12 2 x 7 = 14 2 x 8 = 16 2 x 9 = 18 2 x 10 = 20 ************************************************* 3 x 1 = 3 3 x 2 = 6 3 x 3 = 9 3 x 4 = 12 3 x 5 = 15 3 x 6 = 18 3 x 7 = 21 3 x 8 = 24 3 x 9 = 27 3 x 10 = 30 ************************************************* 4 x 1 = 4 4 x 2 = 8 4 x 3 = 12 4 x 4 = 16 4 x 5 = 20 4 x 6 = 24 4 x 7 = 28 4 x 8 = 32 4 x 9 = 36 4 x 10 = 40 ************************************************* 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 5 x 4 = 20 5 x 5 = 25 5 x 6 = 30 5 x 7 = 35 5 x 8 = 40 5 x 9 = 45 5 x 10 = 50 ************************************************* 6 x 1 = 6 6 x 2 = 12 6 x 3 = 18 6 x 4 = 24 6 x 5 = 30 6 x 6 = 36 6 x 7 = 42 6 x 8 = 48 6 x 9 = 54 6 x 10 = 60 ************************************************* 7 x 1 = 7 7 x 2 = 14 7 x 3 = 21 7 x 4 = 28 7 x 5 = 35 7 x 6 = 42 7 x 7 = 49 7 x 8 = 56 7 x 9 = 63 7 x 10 = 70 ************************************************* 8 x 1 = 8 8 x 2 = 16 8 x 3 = 24 8 x 4 = 32 8 x 5 = 40 8 x 6 = 48 8 x 7 = 56 8 x 8 = 64 8 x 9 = 72 8 x 10 = 80 ************************************************* 9 x 1 = 9 9 x 2 = 18 9 x 3 = 27 9 x 4 = 36 9 x 5 = 45 9 x 6 = 54 9 x 7 = 63 9 x 8 = 72 9 x 9 = 81 9 x 10 = 90 ************************************************* 10 x 1 = 10 10 x 2 = 20 10 x 3 = 30 10 x 4 = 40 10 x 5 = 50 10 x 6 = 60 10 x 7 = 70 10 x 8 = 80 10 x 9 = 90 10 x 10 = 100

Problem 4

toplam = 0 while True: sayı = input("Sayı:") if (sayı == "q"): break sayı = int(sayı) toplam += sayı print("Girdiğiniz Sayıların Toplamı:",toplam)
Sayı:1 Sayı:2 Sayı:3 Sayı:4 Sayı:5 Sayı:6 Sayı:7 Sayı:q Girdiğiniz Sayıların Toplamı: 28

Problem 5

for i in range(1,101): if (i % 3 != 0): continue print(i)
3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99

Problem 6

liste = [x for x in range(1,101) if x % 2 == 0] print(liste)
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]