Created
September 30, 2020 14:59
-
-
Save chicolucio/5821df2346adaaf9f92f5ccfc92498f2 to your computer and use it in GitHub Desktop.
tutorial_ipython.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 2 + 2 | |
4 | |
>>> 2**3 # potência | |
8 | |
>>> lista = [1, 2.3, ['texto',4]] | |
>>> lista | |
[1, 2.3, ['texto', 4]] | |
>>> len(lista) | |
3 | |
>>> import math | |
>>> for elemento in lista: | |
... print(type(elemento)) | |
... | |
>>> len(n) | |
>>> valores = list(range(10)) | |
>>> valores | |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
>>> help(range) | |
>>> ?range | |
>>> %doctest_mode | |
>>> lista | |
[1, 2.3, ['texto', 4]] | |
>>> [1, 'a'] | |
[1, 'a'] | |
>>> %doctest_mode | |
>>> [1, 'a'] | |
[1, 'a'] | |
>>> %history | |
>>> %history -n | |
>>> %history -n 1-6 | |
>>> %history -n 1-6 -o | |
>>> %history -n 1-6 -o -p | |
>>> %history -o -p | |
>>> %history -n | |
>>> %recall 9 | |
>>> valores = list(range(20)) | |
>>> valores | |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] | |
>>> %recall 7 | |
>>> math.pi | |
3.141592653589793 | |
>>> %precision 3 | |
'%.3f' | |
>>> math.pi | |
3.142 | |
>>> f = 7.8 | |
>>> f | |
7.800 | |
>>> %precision | |
'%r' | |
>>> math.pi | |
3.141592653589793 | |
>>> f | |
7.8 | |
>>> n = 10000 | |
>>> %time sum(range(n)) | |
49995000 | |
>>> %timeit sum(range(n)) | |
>>> %who | |
>>> def soma(num1, num2): | |
... return num1 + num2 | |
... | |
>>> %who | |
>>> %who int | |
>>> %who float | |
>>> %who module | |
>>> %whos | |
>>> %whos int | |
>>> %xdel f | |
>>> %whos | |
>>> %history -o -p -f tutorial.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment