Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Variables and Data Types | Getting Started with Python
Python Programming: An Introductory Course

bookVariables and Data Types

Deslize para mostrar o menu

123456789
# Assigning different data types to variables in Python age = 25 # An integer value height = 5.9 # A float value name = "Alex" # A string value print(age) print(height) print(name)
copy

When you assign a value to a variable in Python, the variable stores that value in memory and remembers its type. The int type represents whole numbers without decimals, like 25 in the example above. The float type is used for numbers with decimal points, such as 5.9. The str type, or string, is used for text data and is always enclosed in quotes, as seen with "Alex". Each type serves a unique purpose: use int for counting or indexing; float for precise measurements or calculations with decimals; and str for handling names, messages, or any kind of textual information.

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 2

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 1. Capítulo 2
some-alt