{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# A. Нечетные буквы"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Вариант 1."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "name = input()\n",
    "new_name = ''\n",
    "\n",
    "\n",
    "for i,char in enumerate(name):\n",
    "    if i % 2 != 0:\n",
    "        new_name += '?'\n",
    "    else:\n",
    "        new_name += char\n",
    "print(new_name)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Вариант 2."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "name = input()\n",
    "new_name = ''\n",
    "\n",
    "\n",
    "for i in range(len(name)):\n",
    "    if i % 2 != 0:\n",
    "        new_name += '?'\n",
    "    else:\n",
    "        new_name += name[i]\n",
    "print(new_name)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# B. 100 раз подряд в квадрате"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = input()\n",
    "print(int(100*n)**2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# C. Дубли"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Вариант 1."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = int(input())\n",
    "a = [int(x) for x in input().split()]\n",
    "\n",
    "\n",
    "b = []\n",
    "b_set = set()\n",
    "\n",
    "\n",
    "for item in a:\n",
    "    if item in b_set:\n",
    "        continue \n",
    "    else:\n",
    "        b.append(str(item))\n",
    "        b_set.add(item)\n",
    "print(' '.join(b))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Вариант 2."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 2 3 3 3 1 2 1 4 1 1 1\n",
      "1 2 3 4\n"
     ]
    }
   ],
   "source": [
    "nums = input()\n",
    "nums_sep = nums.split()\n",
    "new_nums = []\n",
    "for num in nums_sep:\n",
    "    if num not in new_nums:\n",
    "        new_nums.append(num)\n",
    "print(' '.join(new_nums))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# D. Дубли-2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "phrase = input()\n",
    "new_phrase = phrase[0]\n",
    "\n",
    "\n",
    "for char in phrase[1:]:\n",
    "    if new_phrase[-1] == char:\n",
    "        continue \n",
    "    else:\n",
    "        new_phrase += char\n",
    "        \n",
    "print(new_phrase)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# E. Магический амулет"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from math import pi \n",
    "\n",
    "\n",
    "def get_sq(r):\n",
    "    return pi * r ** 2\n",
    "\n",
    "\n",
    "r = float(input())\n",
    "print(get_sq(r))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# F. Числа Фибоначчи"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Вариант 1."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = int(input())\n",
    "def app_fib(n):\n",
    "    '''\n",
    "    approximate fibonacci function\n",
    "    two roots z^2 - z - 1 = 0\n",
    "    |z_1| > 1, |z_2| < 1\n",
    "    '''\n",
    "    q5 = 5 ** 0.5\n",
    "    return  ((1 + q5) / 2) ** n / q5\n",
    "\n",
    "# fast fibonacci function\n",
    "def fast_fib(n):\n",
    "    '''\n",
    "    fast fibonacci function\n",
    "    '''\n",
    "    return round(app_fib(n))\n",
    "\n",
    "print(fast_fib(n))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Вариант 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = int(input())\n",
    "fib = []\n",
    "if n == 1 or n == 2:\n",
    "    print(1)\n",
    "else:\n",
    "    fib = [1, 1]\n",
    "    for i in range(2, n):\n",
    "        fib.append(fib[i - 1] + fib[i - 2])\n",
    "    print(fib[n - 1])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# G. Я есть Грут. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Вариант 1."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "phrases = input()\n",
    "print(phrases)\n",
    "#  выкидываем пробелы после предложения (чтобы не обрабатывать кучу случаев) и сплитим по точке\n",
    "phrases = phrases.replace('. ', '.').split('.')\n",
    "# если в конце предложения была точка, сплит запишет отдельным элементом пустой символ. \n",
    "# дропаем его\n",
    "if phrases[-1] == '':\n",
    "    phrases.pop()\n",
    "# делаем лист для записи развернутых предложений\n",
    "new_separated_phrases = []\n",
    "\n",
    "for phrase in phrases:\n",
    "    # сплит слов по пробелу\n",
    "    separated_phrase = phrase.split(' ')\n",
    "    # разворот\n",
    "    separated_phrase.reverse()\n",
    "    # сборка строки и запись с заглвной буквы\n",
    "    new_phrase = ' '.join(separated_phrase).lower().capitalize()\n",
    "    # добавление в лист развернутых предложений\n",
    "    new_separated_phrases.append(new_phrase)\n",
    "# сборка отдельных предложений в единый текст\n",
    "new_phrase = '. '.join(new_separated_phrases) + '.'\n",
    "print(new_phrase)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Вариант 2."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "phrases = input()\n",
    "phrases = phrases.replace('. ', '.').lower().split('.')\n",
    "reversed_phrases = [phrase.split(' ')[::-1] for phrase in phrases if len(phrase) > 0]\n",
    "reverse_phrase_all = [' '.join(phrase).capitalize() for phrase in reversed_phrases]\n",
    "print('. '.join(reverse_phrase_all) + '.')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Напишите \"функцию голосования\", def Election(x, y, z), возвращающую то значение (True или False), которое среди значений ее аргументов x, y, z встречается чаще.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# H. Голосование"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Вариант 1. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "input_str = input()\n",
    "x, y, z = map(int, input_str.split(' '))\n",
    " \n",
    "def Election(x, y, z):\n",
    "    if x + y + z < 2:\n",
    "        return 0\n",
    "    else:\n",
    "        return 1\n",
    "       \n",
    "print(Election(x, y, z))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Вариант 2. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def Election(x,y,z):\n",
    "    if x < 1 and y < 1 or x < 1 and z < 1 or z < 1 and y < 1:\n",
    "        return 0\n",
    "    else:\n",
    "        return 1\n",
    "    \n",
    "d = input().split()\n",
    "d = list(d)\n",
    "x = int(d[0])\n",
    "y = int(d[1])\n",
    "z = int(d[2])\n",
    "print(Election(x, y, z))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}