<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="category">
    <category>
      <text>$course$/top/OnlineCompiler.io Python (português)</text>
    </category>
    <info format="html">
      <text><![CDATA[<p>Questões CodeRunner grátis do OnlineCompiler.io (https://onlinecompiler.io/pt/banco-de-questoes-coderunner), sob a licença CC BY 4.0. Usam os tipos de questão que já vêm com o CodeRunner, então rodam em qualquer servidor Jobe.</p>]]></text>
    </info>
    <idnumber></idnumber>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Soma e diferença]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva um programa que leia dois inteiros, um por linha, e imprima a soma deles na primeira linha e a diferença (o primeiro menos o segundo) na segunda linha.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[a = int(input())
b = int(input())
print(a + b)
print(a - b)
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[7
3
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[10
4]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[-5
12
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[7
-17]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[0
0
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[0
0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[-8
-20
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[-28
12]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>io</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Segundos em H:MM:SS]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva um programa que leia um número inteiro de segundos (0 ou mais) e o imprima como horas, minutos e segundos no formato <code>H:MM:SS</code>. Minutos e segundos têm sempre dois dígitos; as horas não têm zeros à esquerda e podem passar de 24. Por exemplo, <code>3725</code> imprime <code>1:02:05</code>.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[total = int(input())
hours = total // 3600
minutes = total % 3600 // 60
seconds = total % 60
print(f"{hours}:{minutes:02d}:{seconds:02d}")
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[3725
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[1:02:05]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[59
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[0:00:59]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[600
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[0:10:00]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[0
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[0:00:00]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[90061
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[25:01:01]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>io</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Distância entre dois pontos]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>distance(x1, y1, x2, y2)</code> que devolva a distância em linha reta entre os pontos (<code>x1</code>, <code>y1</code>) e (<code>x2</code>, <code>y2</code>), ou seja, a raiz quadrada de <code>(x2 - x1)**2 + (y2 - y1)**2</code>. As coordenadas podem ser negativas ou ter casas decimais. Devolva a distância sem imprimi-la; os testes a imprimem com duas casas decimais, então <code>distance(0, 0, 3, 4)</code> aparece como <code>5.00</code>. Você pode usar <code>math.sqrt</code> depois de <code>import math</code>.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[import math


def distance(x1, y1, x2, y2):
    dx = x2 - x1
    dy = y2 - y1
    return math.sqrt(dx * dx + dy * dy)
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(f"{distance(0, 0, 3, 4):.2f}")]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[5.00]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(f"{distance(1, 1, 1, 1):.2f}")]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0.00]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(f"{distance(-1, -2, 2, 2):.2f}")]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[5.00]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(f"{distance(0, 0, 1, 1):.2f}")]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1.41]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(f"{distance(-3, 5, 4, -1):.2f}")]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[9.22]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(f"{distance(0.5, 0, 0, 2.5):.2f}")]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[2.55]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>functions</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Preço do ingresso por idade]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Um museu define o preço do ingresso pela idade: crianças com menos de 4 anos não pagam (preço 0), de 4 a 11 anos pagam 8, de 12 a 59 anos pagam 15 e pessoas com 60 anos ou mais pagam 10. Escreva uma função <code>ticket_price(age)</code> que devolva o preço para um visitante dessa idade. <code>age</code> é um número inteiro, 0 ou mais.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def ticket_price(age):
    if age < 4:
        return 0
    elif age < 12:
        return 8
    elif age < 60:
        return 15
    else:
        return 10
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(ticket_price(30))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[15]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(ticket_price(7))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[8]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(ticket_price(3), ticket_price(4))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0 8]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(ticket_price(11), ticket_price(12))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[8 15]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(ticket_price(59), ticket_price(60))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[15 10]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(ticket_price(0), ticket_price(95))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0 10]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>conditionals</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Ano bissexto]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>No calendário gregoriano, um ano é bissexto se for divisível por 4, exceto os anos divisíveis por 100, que só são bissextos se também forem divisíveis por 400. Escreva uma função <code>is_leap_year(year)</code> que devolva <code>True</code> se <code>year</code> for bissexto e <code>False</code> caso contrário.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def is_leap_year(year):
    if year % 400 == 0:
        return True
    elif year % 100 == 0:
        return False
    elif year % 4 == 0:
        return True
    else:
        return False
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_leap_year(2024))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[True]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_leap_year(2023))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[False]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_leap_year(1900))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[False]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_leap_year(2000))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[True]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_leap_year(2100), is_leap_year(1600), is_leap_year(1996))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[False True True]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>conditionals</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Quadrante de um ponto]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>quadrant(x, y)</code> que devolva o quadrante do plano onde está o ponto (<code>x</code>, <code>y</code>): 1 quando <code>x &gt; 0</code> e <code>y &gt; 0</code>, 2 quando <code>x &lt; 0</code> e <code>y &gt; 0</code>, 3 quando <code>x &lt; 0</code> e <code>y &lt; 0</code>, e 4 quando <code>x &gt; 0</code> e <code>y &lt; 0</code>. Um ponto sobre um dos eixos (<code>x</code> ou <code>y</code> igual a 0) não está em nenhum quadrante: devolva 0.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def quadrant(x, y):
    if x > 0 and y > 0:
        return 1
    elif x < 0 and y > 0:
        return 2
    elif x < 0 and y < 0:
        return 3
    elif x > 0 and y < 0:
        return 4
    else:
        return 0
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(quadrant(3, 4))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(quadrant(-2, 5))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[2]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(quadrant(-1, -1))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(quadrant(0, -6))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(quadrant(7, -3), quadrant(-0.5, 2.5))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[4 2]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(quadrant(4, 0), quadrant(0, 0), quadrant(0, 9))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0 0 0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>conditionals</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Tabuada de multiplicação]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva um programa que leia um inteiro <i>n</i> e imprima a tabuada de <i>n</i> de 1 a 10, uma linha por multiplicação, no formato <code>n x i = resultado</code> (um <code>x</code> minúsculo, com um espaço de cada lado do <code>x</code> e do <code>=</code>). Por exemplo, para 7 a primeira linha é <code>7 x 1 = 7</code> e a última é <code>7 x 10 = 70</code>. <i>n</i> pode ser zero ou negativo.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[n = int(input())
for i in range(1, 11):
    print(f"{n} x {i} = {n * i}")
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[7
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[1
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[1 x 1 = 1
1 x 2 = 2
1 x 3 = 3
1 x 4 = 4
1 x 5 = 5
1 x 6 = 6
1 x 7 = 7
1 x 8 = 8
1 x 9 = 9
1 x 10 = 10]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[-3
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[-3 x 1 = -3
-3 x 2 = -6
-3 x 3 = -9
-3 x 4 = -12
-3 x 5 = -15
-3 x 6 = -18
-3 x 7 = -21
-3 x 8 = -24
-3 x 9 = -27
-3 x 10 = -30]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[0
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[0 x 1 = 0
0 x 2 = 0
0 x 3 = 0
0 x 4 = 0
0 x 5 = 0
0 x 6 = 0
0 x 7 = 0
0 x 8 = 0
0 x 9 = 0
0 x 10 = 0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[12
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[12 x 1 = 12
12 x 2 = 24
12 x 3 = 36
12 x 4 = 48
12 x 5 = 60
12 x 6 = 72
12 x 7 = 84
12 x 8 = 96
12 x 9 = 108
12 x 10 = 120]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>loops</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Soma dos dígitos]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>digit_sum(n)</code> que devolva a soma dos dígitos do inteiro <code>n</code>. Para um número negativo, some os dígitos do seu valor absoluto; <code>digit_sum(0)</code> é 0. Use um laço <code>while</code> com <code>% 10</code> (o último dígito) e <code>// 10</code> (remove o último dígito) em vez de converter o número em string.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def digit_sum(n):
    n = abs(n)
    total = 0
    while n > 0:
        total += n % 10
        n = n // 10
    return total
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(digit_sum(1234))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[10]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(digit_sum(7))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[7]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(digit_sum(0))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(digit_sum(1000000))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(digit_sum(-507))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[12]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(digit_sum(99999))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[45]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>loops</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Passos de Collatz]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>A partir de um inteiro positivo <code>n</code>, repita este passo até o número chegar a 1: se ele for par, divida-o por 2; se for ímpar, multiplique-o por 3 e some 1. Escreva uma função <code>collatz_steps(n)</code> que devolva quantos passos são necessários. Por exemplo, 6 passa por 6, 3, 10, 5, 16, 8, 4, 2, 1, ou seja, 8 passos; <code>collatz_steps(1)</code> é 0.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def collatz_steps(n):
    steps = 0
    while n != 1:
        if n % 2 == 0:
            n = n // 2
        else:
            n = 3 * n + 1
        steps += 1
    return steps
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(collatz_steps(6))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[8]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(collatz_steps(1))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(collatz_steps(2))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(collatz_steps(7))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[16]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(collatz_steps(27))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[111]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>loops</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Contando primos]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva duas funções. <code>is_prime(n)</code> devolve <code>True</code> se o inteiro <code>n</code> for primo e <code>False</code> caso contrário; números menores que 2 (incluindo 0 e os negativos) não são primos. <code>count_primes(a, b)</code> devolve quantos primos há de <code>a</code> até <code>b</code>, incluindo os dois, e deve usar <code>is_prime</code>; se <code>a</code> for maior que <code>b</code>, devolve 0.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def is_prime(n):
    if n < 2:
        return False
    divisor = 2
    while divisor * divisor <= n:
        if n % divisor == 0:
            return False
        divisor += 1
    return True


def count_primes(a, b):
    count = 0
    for n in range(a, b + 1):
        if is_prime(n):
            count += 1
    return count
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_prime(7), is_prime(10))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[True False]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(count_primes(1, 10))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[4]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_prime(2), is_prime(1), is_prime(0), is_prime(-7))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[True False False False]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(count_primes(2, 13))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[6]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_prime(49), is_prime(97), is_prime(121))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[False True False]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(count_primes(20, 10), count_primes(24, 28), count_primes(-5, 3))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0 0 2]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>functions</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Contar as vogais]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>count_vowels(text)</code> que devolva quantas vogais (a, e, i, o, u, maiúsculas ou minúsculas) há em <code>text</code>.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def count_vowels(text):
    count = 0
    for ch in text.lower():
        if ch in "aeiou":
            count += 1
    return count
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(count_vowels("Hello World"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(count_vowels("AEIOU aeiou"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[10]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(count_vowels("rhythm"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(count_vowels(""))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>strings</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[É um palíndromo?]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>is_palindrome(text)</code> que devolva <code>True</code> se <code>text</code> for igual lido da esquerda para a direita e da direita para a esquerda, e <code>False</code> caso contrário. Só contam letras e dígitos (os caracteres para os quais <code>isalnum()</code> é verdadeiro), e maiúsculas e minúsculas são consideradas iguais, então <code>"Roma me tem amor"</code> é um palíndromo. Uma string sem letras nem dígitos, como <code>""</code>, é um palíndromo.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def is_palindrome(text):
    cleaned = ""
    for ch in text.lower():
        if ch.isalnum():
            cleaned += ch
    return cleaned == cleaned[::-1]
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_palindrome("Reconocer"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[True]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_palindrome("Python"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[False]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_palindrome("Roma me tem amor"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[True]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_palindrome("Anita lava la tina"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[True]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_palindrome("1a2-2A1"), is_palindrome("ab"), is_palindrome("abca"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[True False False]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(is_palindrome(""), is_palindrome("?! ."))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[True True]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>strings</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Cifra de César]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>caesar(text, shift)</code> que devolva <code>text</code> cifrado com a cifra de César: cada letra de <code>a</code> a <code>z</code> e de <code>A</code> a <code>Z</code> avança <code>shift</code> posições no alfabeto, voltando ao início depois do <code>z</code>; maiúsculas continuam maiúsculas e minúsculas continuam minúsculas. Todos os outros caracteres (dígitos, espaços, pontuação e letras como <code>ç</code>, <code>ã</code> ou <code>é</code>) ficam como estão. <code>shift</code> pode ser qualquer inteiro: valores negativos fazem as letras voltarem, e 27 funciona como 1.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def caesar(text, shift):
    result = ""
    for ch in text:
        if "a" <= ch <= "z":
            result += chr((ord(ch) - ord("a") + shift) % 26 + ord("a"))
        elif "A" <= ch <= "Z":
            result += chr((ord(ch) - ord("A") + shift) % 26 + ord("A"))
        else:
            result += ch
    return result
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(caesar("abc", 1))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[bcd]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(caesar("xyz XYZ", 3))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[abc ABC]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(caesar("Hola, Mundo 2026!", 5))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[Mtqf, Rzsit 2026!]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(caesar("abc", -1))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[zab]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(caesar("Ação", 2), caesar("Año", 1))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[Cçãq Bñp]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(caesar("Zebra", 27), caesar("Zebra", -52), len(caesar("", 4)))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[Afcsb Zebra 0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>strings</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Soma acumulada]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>running_total(numbers)</code> que receba uma lista de números e devolva uma nova lista, do mesmo tamanho, em que cada elemento é a soma dos elementos de <code>numbers</code> até aquela posição, inclusive. Por exemplo, <code>running_total([1, 2, 3, 4])</code> devolve <code>[1, 3, 6, 10]</code>. Uma lista vazia dá uma lista vazia, e a lista original não pode ser alterada.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def running_total(numbers):
    totals = []
    total = 0
    for n in numbers:
        total += n
        totals.append(total)
    return totals
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(running_total([1, 2, 3, 4]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[1, 3, 6, 10]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(running_total([5]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[5]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(running_total([]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(running_total([3, -3, 3, -3]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[3, 0, 3, 0]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[nums = [2, 4, 6]
result = running_total(nums)
print(nums, result)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[2, 4, 6] [2, 6, 12]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(running_total([10, 0, -5, 2.5]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[10, 10, 5, 7.5]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>lists</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Segundo maior valor]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>second_largest(numbers)</code> que devolva o segundo maior valor distinto da lista <code>numbers</code>. Valores repetidos contam uma vez só, então para <code>[5, 5, 3]</code> a resposta é 3. Se a lista tiver menos de dois valores distintos (por exemplo <code>[]</code> ou <code>[7, 7]</code>), devolva <code>None</code>. Os números podem ser negativos. Não altere a lista.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def second_largest(numbers):
    largest = None
    second = None
    for n in numbers:
        if largest is None or n > largest:
            second = largest
            largest = n
        elif n < largest and (second is None or n > second):
            second = n
    return second
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(second_largest([3, 9, 4]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[4]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(second_largest([5, 5, 3]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(second_largest([7, 7]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[None]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(second_largest([-2, -8, -5]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[-5]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(second_largest([]), second_largest([4]), second_largest([1, 2, 2, 2]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[None None 1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[nums = [3, 1, 2]
print(second_largest(nums), nums)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[2 [3, 1, 2]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>lists</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Matriz transposta]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Uma matriz é guardada como uma lista de linhas, cada linha uma lista de números, todas do mesmo tamanho. Escreva uma função <code>transpose(matrix)</code> que devolva uma nova matriz, como lista de listas, cujas linhas são as colunas de <code>matrix</code>: o elemento da linha <i>i</i>, coluna <i>j</i> vai para a linha <i>j</i>, coluna <i>i</i>. A matriz não precisa ser quadrada. Para a matriz vazia <code>[]</code>, devolva <code>[]</code>.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def transpose(matrix):
    if len(matrix) == 0:
        return []
    result = []
    for j in range(len(matrix[0])):
        new_row = []
        for row in matrix:
            new_row.append(row[j])
        result.append(new_row)
    return result
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(transpose([[1, 2], [3, 4]]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[[1, 3], [2, 4]]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(transpose([[1, 2, 3], [4, 5, 6]]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[[1, 4], [2, 5], [3, 6]]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(transpose([[7]]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[[7]]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(transpose([[1], [2], [3]]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[[1, 2, 3]]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(transpose([]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(transpose([[1, -2, 0, 4], [5, 6, 7, -8]]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[[1, 5], [-2, 6], [0, 7], [4, -8]]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>lists</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Contando palavras]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>count_words(text)</code> que devolva um dicionário que associa cada palavra de <code>text</code> ao número de vezes que ela aparece. As palavras são separadas por um ou mais espaços (também pode haver espaços no início ou no fim) e são comparadas sem diferenciar maiúsculas de minúsculas: guarde cada palavra em minúsculas. O texto não tem pontuação, e um texto vazio dá um dicionário vazio. Os testes imprimem <code>sorted(count_words(text).items())</code>, então a ordem em que você insere as chaves não importa.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def count_words(text):
    counts = {}
    for word in text.lower().split():
        if word in counts:
            counts[word] += 1
        else:
            counts[word] = 1
    return counts
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(sorted(count_words("a b a c b a").items()))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[('a', 3), ('b', 2), ('c', 1)]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(sorted(count_words("Hola hola HOLA mundo").items()))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[('hola', 3), ('mundo', 1)]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(sorted(count_words("o gato viu o outro gato").items()))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[('gato', 2), ('o', 2), ('outro', 1), ('viu', 1)]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(sorted(count_words("").items()))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(sorted(count_words("  uno   dos  UNO ").items()))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[('dos', 1), ('uno', 2)]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>maps</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Vencedor da eleição]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva um programa que conte votos. A primeira linha da entrada tem o número de votos <i>n</i> (pelo menos 1), e cada uma das <i>n</i> linhas seguintes tem o nome de um candidato. Imprima o nome do candidato mais votado, um espaço e o número de votos dele. Se houver empate entre os mais votados, imprima o nome que vem primeiro em ordem alfabética (os nomes são uma só palavra sem acento, com a primeira letra maiúscula e as outras minúsculas, então compará-los com <code>&lt;</code> dá essa ordem). Use um dicionário para contar.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[n = int(input())
votes = {}
for _ in range(n):
    name = input().strip()
    votes[name] = votes.get(name, 0) + 1

# Visit the names in alphabetical order and only replace the leader on
# strictly more votes, so a tie keeps the name that comes first.
winner = None
for name in sorted(votes):
    if winner is None or votes[name] > votes[winner]:
        winner = name
print(winner, votes[winner])
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[5
Ana
Bruno
Ana
Carla
Ana
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[Ana 3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[4
Bruno
Ana
Bruno
Ana
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[Ana 2]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[1
Zeca
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[Zeca 1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[7
Maria
Jose
Maria
Pedro
Jose
Maria
Pedro
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[Maria 3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[6
Luis
Marta
Luis
Marta
Diego
Diego
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[Diego 2]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[5
Teo
Sofia
Teo
Sofia
Teo
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[Teo 3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>maps</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Soma de lista aninhada]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Uma lista aninhada é uma lista cujos elementos são inteiros ou outras listas aninhadas, em qualquer profundidade, como <code>[1, [2, 3], [[4]], 5]</code>. Escreva uma função recursiva <code>nested_sum(items)</code> que devolva a soma de todos os inteiros dentro de <code>items</code>, em todos os níveis. Listas vazias não somam nada, então <code>nested_sum([])</code> é 0. Dica: <code>isinstance(x, list)</code> diz se <code>x</code> é uma lista.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def nested_sum(items):
    total = 0
    for item in items:
        if isinstance(item, list):
            total += nested_sum(item)
        else:
            total += item
    return total
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(nested_sum([1, [2, 3], [[4]], 5]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[15]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(nested_sum([1, 2, 3]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[6]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(nested_sum([]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(nested_sum([-1, [-2, [3]]]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(nested_sum([[], [[]], []]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(nested_sum([[1, [2, [3, [4, [5]]]]], 10]))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[25]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>recursion</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Busca binária]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escreva uma função <code>binary_search(items, target)</code> que devolva o índice de <code>target</code> na lista <code>items</code>, ou <code>-1</code> se ele não estiver nela. <code>items</code> está em ordem crescente, sem valores repetidos, e pode ser vazia. Use busca binária: mantenha o intervalo de índices onde <code>target</code> ainda pode estar, olhe o elemento do meio e descarte a metade que não pode contê-lo. Não use <code>items.index</code>, o operador <code>in</code> nem um laço que verifique todos os elementos.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>python3</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[def binary_search(items, target):
    low = 0
    high = len(items) - 1
    while low <= high:
        middle = (low + high) // 2
        if items[middle] == target:
            return middle
        elif items[middle] < target:
            low = middle + 1
        else:
            high = middle - 1
    return -1
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(binary_search([1, 3, 5, 7, 9], 7))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(binary_search([1, 3, 5, 7, 9], 4))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[-1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(binary_search([1, 3, 5, 7, 9], 1), binary_search([1, 3, 5, 7, 9], 9))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0 4]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(binary_search([], 5), binary_search([42], 42), binary_search([42], 7))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[-1 0 -1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[evens = list(range(0, 1000, 2))
print(binary_search(evens, 998), binary_search(evens, 0), binary_search(evens, 500))
print(binary_search(evens, 501), binary_search(evens, -2), binary_search(evens, 1000))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[499 0 250
-1 -1 -1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print(binary_search([-10, -3, 0, 8], -3), binary_search([-10, -3, 0, 8], 10))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1 -1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>python</text></tag>
      <tag><text>algorithms</text></tag>
    </tags>
  </question>
</quiz>
