This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mukemmel_sayi(sayi): | |
lst = [i for i in range(1, sayi) if sayi % i == 0] | |
sum = 0 | |
for i in lst: | |
sum += i | |
if sum == sayi: | |
print(sayi) | |
for i in range(1, 1001): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ebob(num1,num2): | |
lst = [] | |
max = 0 | |
for i in range(1,num1): | |
if num1 % i == 0 and num2 % i == 0: | |
lst.append(i) | |
for i in lst: | |
if i > max: | |
max = i | |
return max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ekok(num1, num2): | |
x = num1 | |
while True: | |
x += num1 | |
if x % num2 == 0 and x > num2: | |
return x | |
print("**ekok**") | |
num1 = int(input("1.sayı:")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numbers = [-2, 5, 16, 21, -21, 1] | |
def Find_max(list): | |
if len(list) == 1: | |
return list[0] | |
else: | |
max = Find_max(list[1:]) | |
return max if max > list[0] else list[0] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibonacci(num): | |
if num <= 1: | |
return 1 | |
else: | |
return fibonacci(num-1) + fibonacci(num-2) | |
num = int(input('How many?:')) | |
if num <= 0: | |
print('Enter a positive number.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum_of_multipliers(number): | |
sum_of_multipliers = 0 | |
for i in range (1,number): | |
if number % i == 0: | |
sum_of_multipliers += i | |
return sum_of_multipliers | |
for i in range(1,10000): | |
if i == sum_of_multipliers(i): | |
print(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sqrt(number): | |
return int(number ** 0.5) | |
def prime_number(number): | |
for i in range(2, sqrt(number)): | |
if number % i == 0: | |
print(number, 'is not a prime number') | |
break | |
else: | |
print(number, 'is a prime number') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print('you can terminate the operation by entering 0') | |
while True: | |
number = int(input('Enter a number:')) | |
if number > 1: | |
for i in range(2, number): | |
if number % i == 0: | |
print(number, 'is not a prime number') | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Determine the range of prime numbers you want to find") | |
num_1 = int(input("Lower limit:")) | |
num_2 = int(input("Upper limit:")) | |
print("Prime numbers between", num_1, "and", num_2) | |
for i in range(num_1, num_2 + 1): | |
if i > 1: | |
for num in range(2, i): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car: | |
def __init__(self): | |
self.make = "Lamborghini" | |
self.model = "Gallardo" | |
self.car_segment = "supercars" | |
self.year = "2013" | |
self.body_style = "coupe" | |
self.top_speed = 325 | |
self.speed = 0 | |
self.gas = 0 |