Quick actions

cmd+k|ctrl+k

Navigation

Languages

27 Создатель персонажей

Snippet info

Language

Python

Visibility

public

Author

python100

Created

2025-07-29T19:28:17.803996Z

Updated

2025-07-29T19:28:17.803996Z

import random
import time
import os

def roll_dice(sides):
    return random.randint(1, sides)

def generate_character():
    os.system("cls")
    print("Создание персонажа")
    print("══════════════════")
    
    name = input("Назовите своего персонажа: ")
    race = input("Тип персонажа (человек, эльф, виард, орк, чертёнок, волшебник): ")
    
    health = (roll_dice(6) * roll_dice(12)) // 2 + 10
    strength = (roll_dice(6) * roll_dice(12)) // 2 + 12
    
    os.system("cls")
    print(name)
    print(race)
    print("══════════════════")
    print("ЗДОРОВЬЕ:", health)
    print("СИЛА:", strength)
    print("")
    print("Да войдет ваше имя в легенду...")
    time.sleep(3)

while True:
    generate_character()
    
    choice = input("Создать нового персонажа? (да/нет): ")
    if choice != "да" and choice != "Да":
        os.system("cls")
        print("")
        print("До новых встреч!")
        break
INFO