Skip to content

Commit 50637ff

Browse files
EngOmarElsayedSSwiniarskicaupolicandiaz
authored
* new file * remove oct * oct file * Update oct.md * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md * Update content/python/concepts/built-in-functions/terms/oct/oct.md * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: SSwiniarski <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: caupolicandiaz <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: caupolicandiaz <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: caupolicandiaz <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: caupolicandiaz <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: caupolicandiaz <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: caupolicandiaz <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: caupolicandiaz <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: caupolicandiaz <[email protected]> * Update content/python/concepts/built-in-functions/terms/oct/oct.md Co-authored-by: caupolicandiaz <[email protected]> * review edits --------- Co-authored-by: SSwiniarski <[email protected]> Co-authored-by: caupolicandiaz <[email protected]>
1 parent 10bcbe6 commit 50637ff

File tree

1 file changed

+62
-0
lines changed
  • content/python/concepts/built-in-functions/terms/oct

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
Title: 'oct()' # Required; the file name should be the same as the title, but lowercase, with dashes instead of spaces, and all punctuation removed
3+
Description: 'Used to get an octal value of an integer number' # Required; ideally under 150 characters and starts with a present-tense verb (used in search engine results and content previews)
4+
Subjects: # Please only use Subjects in the subjects.md file (https://github.com/Codecademy/docs/blob/main/documentation/subjects.md). If that list feels insufficient, feel free to create a new Subject and add it to subjects.md in your PR!
5+
- 'Computer Science'
6+
- 'Data Science'
7+
- 'Code Foundations'
8+
Tags: # Please only use Tags in the tags.md file (https://github.com/Codecademy/docs/blob/main/documentation/tags.md). If that list feels insufficient, feel free to create a new Tag and add it to tags.md in your PR!
9+
- 'Functions'
10+
- 'Numbers'
11+
- 'Data Types'
12+
CatalogContent: # Please use course/path landing page slugs, rather than linking to individual content items. If listing multiple items, please put the most relevant one first
13+
- 'learn-python-3'
14+
- 'paths/computer-science'
15+
---
16+
17+
The **`oct()`** function takes an integer and returns the corresponding octal string.
18+
19+
## Syntax
20+
21+
```pseudo
22+
23+
oct(integer)
24+
```
25+
26+
Where `integer` is the value to be converted into an octal string.
27+
28+
The function returns an octal string.
29+
30+
## Example
31+
32+
This example returns the octal string for the value `10`.
33+
34+
```py
35+
# Calling function
36+
val = oct(10)
37+
# Displaying result
38+
print("Octal value of 10:",val)
39+
```
40+
41+
This example results in the following output:
42+
43+
```shell
44+
Octal value of 10: 0o12
45+
```
46+
47+
## Codebyte Example
48+
49+
In Python, binary and hexadecimal values are integer values. So, the `oct()` function can convert binary and hexadecimal values as well.
50+
51+
```codebyte/python
52+
# Calling function
53+
val = oct(0b0101) # Binary to octal
54+
val2 = oct(0XAF) # Hexadecimal to octal
55+
# Displaying result
56+
# Binary number
57+
58+
print("Octal value of 0b0101:",val)
59+
# Hexadecimal number
60+
61+
print("Octal value of 0XAF:",val2)
62+
```

0 commit comments

Comments
 (0)