Castle
agent12
play293
12
3 Comments
Next up
New python code!
import time # Global Variables player_position = 0 # Track the player's position on the blocks blocks = list("■■■■■■■■■□□□□") # Block layout player_health = 900 boss_health = 300 game_running = True # Functions for Gameplay def display_layout(): """Display the current game layout.""" print("\nGame Layout:") print(f"# {''.join(blocks)}") print(" 🐁 🐁") print("□□□□■■■■■■■■■") print(" 🐍 🏴") print("■■■■■■■■■■■") print() def move_player(): """Move the player across the blocks and cause falling blocks.""" global player_position, blocks if player_position < len(blocks): # Ensure the player stays within the bounds if blocks[player_position] == "□": blocks[player_position] = "■" # The block beneath the player falls player_position += 1 print("\nYou moved forward.") else: print("\nYou can't move forward anymore.") display_layout() def attack_boss(): """
fire1Reply
ur Russian????
Reply
def add(x, y): return x + y def subtract(x, y): return x - y def multiply(x, y): return x * y def divide(x, y): if y == 0: return "Ошибка: деление на ноль!" return x / y print("Простой калькулятор") print("Выберите операцию:") print("1. Сложение") print("2. Вычитание") print("3. Умножение") print("4. Деление") choice = input("Введите номер операции (1/2/3/4): ") try: num1 = float(input("Введите первое число: ")) num2 = float(input("Введите второе число: ")) if choice == '1': print("Результат:", add(num1, num2)) elif choice == '2': print("Результат:", subtract(num1, num2)) elif choice == '3': print("Результат:", multiply(num1, num2)) elif choice == '4': print("Результат:", divide(num1, num2)) else: print("Неверный ввод операции.") except ValueError: print("Ошибка: введено не число.") Simple calculator in python
Reply