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
# list = [100,200,300,400,500] | |
# l2 = [] | |
# for item in list: | |
# l2.append(item*item) | |
# l2 = [item*item for item in list] | |
# print(l2) |
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
import re | |
# string = re.search('Sırat','Sırat,Sırat orada mısın? Sırat hayat nasıl?') | |
# string2 = re.findall('Sırat','Sırat,Sırat orada mısın? Sırat hayat nasıl?') | |
# print(string.start()) | |
# print(string.end()) | |
# print(len(string2)) | |
# compiler = re.compile('.aman') # Derleyecek olan komudu compiler olarak belirttik. | |
# print(re.findall(compiler,'O her zaman yamandı ve saman altından su yürütürdü.')) |
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
# map | |
def karesiniAl(sayi): | |
return sayi ** 2 | |
def sayilariTopla(sayi1,sayi2): | |
return sayi1+sayi2 | |
def kucukOlaniBul(sayi1,sayi2): |
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
from functools import reduce | |
numbers = [11,24,13,54,43,19,37] | |
numbers2 = [2,3,4,5,6] | |
def multiplication(num1,num2): | |
return num1 * num2 | |
def find_max(num1,num2): | |
if num1 > num2: |
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
import json | |
import os | |
# DESCRIBE AN USER | |
class User: | |
def __init__(self,username,password,email): | |
self.username = username | |
self.password = password | |
self.email = email |
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 ortalamalariOku(): | |
with open('sinav_notlari.txt', 'r', encoding='utf-8') as file: | |
for satir in file: | |
print(notHesapla(satir)) | |
def notHesapla(satir): |
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
# open() komudu ile dosya işlemleri başlar, | |
# open('dosya_adi','islem_adi') formatında olur. | |
# w -> Dosya yazma islemi, -> Eğer dosya yoksa olusturur, var ise de olan dosyayı sıfırlayıp tekrar yazar. | |
file = open('filename.txt', 'w', encoding='utf-8') # encoding='utf-8' türkçe karakterlerin okunmasına izin verir. | |
file.write('Selam Sırat!') | |
file.close() | |
file = open('filename.txt', 'w', encoding='utf-8') |
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
import random | |
random_integer = random.randint(1,10) | |
print(random_integer) | |
# 0.00001 -> 4.99999 | |
random_float = random.random() * 5 | |
print(random_float) |
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
# 1: Liste elemanları içerisindeki sayısal değerleri bulunuz. | |
# 2: Kullanıcı 'q' değerini girmedikçe girilen her inputun sayı olduğunu doğrulayınız. | |
# 3: Girilen parola içerisinde Türkçe karakter hatası veriniz. | |
# 4: Faktoriyeli alınacak değerin uygun değer olmaması halinde hata fırlat. | |
# 1 >> | |
list = ['100','20','abc','trt','21.0','#@','S','5a'] | |
second_list = [] |
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
from turtle import Turtle,Screen | |
import random | |
screen = Screen() | |
screen.setup(width=500,height=400) | |
user_bet = screen.textinput('Turtle Race','Which color will you bet on?\nEnter a color: ') | |
colors = ['red','blue','cyan','pink','purple'] | |
all_turtles = [] | |
y_position = [-80,-40,0,40,80] |
OlderNewer