Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
I made a Mastermind like game

Hi

This is my first code ever so please be kind. I just finished some online tutorial and wanted to test what I remembered from it. Thank you in advance for your time.

#game mastermind
#code breaking game

#X = not in phrase
#O = in phrase and in the right place
#A = in phrase but at the wrong place

import random

print('Mastermind !')

maxnumber=input('Input your maximum number between 4 and 9 (9 being the hardest) : ')

phrase = [random.randint(1,int(maxnumber))]
for x in range(3):
a = random.randint(1,int(maxnumber))
while a in phrase:
a = random.randint(1,int(maxnumber))
phrase.append(a)

playerphrase= 0000
counter = 0

maxcounter=input('How many turns do you want to give yourself (3 is not doable 4 is hard and it gets easier

/r/Python
https://redd.it/k1fmq5
server error 500 after depolying on railway

from pathlib import Path
import os
from dotenv import load_dotenv
import dj_database_url

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

load_dotenv()
# testing git
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-3b^6!pu6k5=&s#x^gi7l6^v*(^9mfhw3y+2^owx605$qgekv-e'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

if os.environ.get("ENVIRONMENT") == "production":
ALLOWED_HOSTS = ["ecommerce-production-30e6.up.railway.app","www.elbencs.com","elbencs.com"]
CSRF_TRUSTED_ORIGINS = ["https://ecommerce-production-30e6.up.railway.app","https://elbencs.com","https://www.elbencs.com"]
DEBUG = False
else:
ALLOWED_HOSTS = ["*"]


# Application definition


/r/djangolearning
https://redd.it/1kaojmd