# Nakafa Framework: LLM
URL: /en/subject/university/bachelor/ai-ds/ai-programming/number-attribute-method
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/subject/university/bachelor/ai-ds/ai-programming/number-attribute-method/en.mdx
Output docs content for large language models.
---
export const metadata = {
    title: "Number Attributes and Methods",
    description: "Master Python number attributes like real, imag and methods like conjugate() for complex numbers. Complete guide with practical code examples.",
    authors: [{ name: "Nabil Akbarazzima Fatih" }],
    date: "09/16/2025",
    subject: "AI Programming",
};
## Basic Concept of Numbers as Objects
In Python, every number is an object that has its own attributes and methods. This concept might sound strange at first, but it's actually very simple. Think of numbers like a box that not only contains a value, but also has special capabilities that you can use.
When you write  or , Python doesn't just store that number, but also provides various functions that you can call to manipulate or get information from that number.
## Accessing Attributes and Methods
To access attributes from a number object, you use the syntax `object.attribute`. While to call methods, you use the syntax `object.method()`.
Let's look at a practical example with complex numbers:
## Ways to View Available Attributes and Methods
Python provides several ways to see what attributes and methods are available on a number object.
### Using the type() Function
The `type()` function shows the type of object you're dealing with:
print(type(3.14))      # Output: 
print(type(2+3j))      # Output: `
    }
  ]}
/>
## Complex Number Attributes
Complex numbers have two main attributes that are very useful:
### The real Attribute
The `real` attribute gives the real part of a complex number:
### The imag Attribute
The `imag` attribute gives the imaginary part of a complex number:
## Complex Number Methods
### The conjugate() Method
The `conjugate()` method returns the complex conjugate of a number. A complex conjugate is a number with the same real part but opposite sign imaginary part.
### Practical Use of Conjugate
Complex conjugates are very useful in various mathematical calculations, especially for calculating the modulus of complex numbers:
## Attributes and Methods on Other Numbers
Although the examples above focus on complex numbers, integers and floats also have their own attributes and methods.
### Integer Numbers
### Float Numbers
## Practical Applications in Programming
### Data Validation
Number attributes and methods are very useful for data validation:
### Mathematical Calculations
Understanding number attributes and methods will be very helpful when you work with more complex mathematical calculations, especially in the context of AI programming which often involves advanced numerical operations.