Created
March 17, 2021 13:59
-
-
Save lecuseasar/70d628460bd273ca82fca07179db0ab0 to your computer and use it in GitHub Desktop.
Konsoldan oynanan bir sayısal-loto programı geliştirin. Programın tuttuğu ile bizim girdiğimiz sayıdan kaç tanesi tutacak.
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 | |
def sayi_uret(s=1, f=49, c=6): | |
numbers = set() | |
while len(numbers) < c: | |
numbers.add(random.randrange(s, f)) | |
return numbers | |
arr = list(sayi_uret()) | |
prediction = [] | |
prediction.append(int(input(f'Tahmin 1 : '))) | |
prediction.append(int(input(f'Tahmin 2 : '))) | |
prediction.append(int(input(f'Tahmin 3 : '))) | |
prediction.append(int(input(f'Tahmin 4 : '))) | |
prediction.append(int(input(f'Tahmin 5 : '))) | |
prediction.append(int(input(f'Tahmin 6 : '))) | |
correctly_predicted_numbers = [] | |
for i in prediction: | |
if i in arr: | |
correctly_predicted_numbers.append(i) | |
print(f'Doğru tahmin edilen sayılar : {correctly_predicted_numbers}') | |
print(f'Bütün tahminleriniz : {prediction}') | |
print(f'Doğru sayılar : {arr}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment