- Executores
-
Aprender
Aprender Python Exemplos executáveis, NumPy, pandas e mais Aprender IA / Machine LearningRedes neurais, ML e LLMs do zero Aprender C e C++ Ponteiros, memória, STL e C++ moderno Aprender C#Fundamentos, POO, LINQ, async e exercícios .NET Aprender MatplotlibGráficos de linha, barras, dispersão e pizza com visualizadores Aprender RustOwnership, traits, tratamento de erros e threads Aprender GoSlices, interfaces, goroutines e channels Algoritmos em Python Busca, ordenação, recursão e visualizações O(n) Algoritmos em C e C++ Compare implementações em C e C++ Programação para crianças Aprenda a programar brincando!
- QuizzesNovo
- DesafiosNovo
- Para professoresNovo
- Atualizações
- Me pague um café
Quiz de Python: Type Hints
This Python quiz checks how well you understand type hints, from int | None and list[str] to Callable, Literal and NamedTuple. It also tests the most common misunderstanding of all - that Python checks your hints when the code runs.
Pergunta de exemplo
Pergunta 1 de 10What does this print?
def add(a: int, b: int) -> int:
return a + b
print(add("4", "2"))
Mostrar a resposta
C. 42 Python does not check type hints when the code runs. The two strings are simply joined with +, giving 42. A static checker like mypy would flag this call before you run it.
O que este quiz cobre
- Hints are not enforced at run time
int | None,list[str]anddict[str, int]Callable,LiteralandNamedTuple__annotations__and static checkers like mypy- Hints and
isinstance()
Perguntas frequentes
Preciso de uma conta?
Não. Qualquer pessoa pode jogar. Entre para guardar seu XP, sequência, badges e histórico.
Qual versão do Python?
Python 3.12. Toda pergunta sobre a saída foi conferida rodando o código.
Posso refazer?
Pode. Sua melhor nota fica salva, e as perguntas e respostas são embaralhadas a cada vez.