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 | |
liste = [1,2,3,4,5] | |
def carp(mevcut, siradaki): | |
return mevcut*siradaki | |
print(reduce(carp, liste)) | |
#out: 120 |
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
liste = [1,2,3,4,5,6,7,8,9,10] | |
def cift(sayi): | |
return sayi%2==0 | |
print(list(filter(cift, liste))) | |
# out: [2, 4, 6, 8, 10] | |
# yada lambda terimi ile kullanalım | |
print(list(filter(lambda sayi: sayi%2==0, liste))) |
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
liste = [1,2,3,4] | |
def arttir(sayi): | |
return sayi *5+2 | |
print(list(map(arttir, liste))) | |
# out: [7, 12, 17, 22] | |
# yada lambda terimi ile kullanalım | |
print(list(map(lambda sayi: sayi *5+2, liste))) |
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
toplama = lambda sayi_1, sayi_2 : sayi_1+sayi_2 | |
print(toplama(11,11)) | |
# out: 22 |
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
arttir = lambda sayi : sayi*5+2 | |
print(arttir(4)) | |
# out: 22 |
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 arttir(sayi): | |
return sayi*5+2 | |
print(arttir(4)) | |
#out: 22 |
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
<?php | |
// src/Serializer/UserContextBuilder.php | |
namespace App\Serializer; | |
use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface; | |
use Symfony\Component\HttpFoundation\Request; | |
use App\Entity\User; | |
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; | |
final class UserContextBuilder implements SerializerContextBuilderInterface |
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
<?php | |
// api/src/Entity/User.php | |
namespace App\Entity; | |
use ApiPlatform\Core\Annotation\ApiResource; | |
use Symfony\Component\Serializer\Annotation\Groups; | |
/** | |
* @ApiResource( |
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
<?php | |
namespace App\DoctrineExtension; | |
use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryCollectionExtensionInterface; | |
use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryItemExtensionInterface; | |
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface; | |
use App\Entity\News; | |
use Doctrine\ORM\QueryBuilder; | |
use Symfony\Component\Security\Core\Security; |
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
<?php | |
// src/Entity/News.php | |
namespace App\Entity; | |
use ApiPlatform\Core\Annotation\ApiResource; | |
use Symfony\Component\Serializer\Annotation\Groups; | |
/** | |
* @ApiResource |