Python 3.8.5 | packaged by conda-forge | (default, Sep 24 2020, 16:55:52)
Type "copyright", "credits" or "license" for more information.
IPython 7.18.1 -- An enhanced Interactive Python.
Restarting kernel...
In [1]: import volum
Traceback (most recent call last):
File "<ipython-input-1-f29f3566f3c3>", line 1, in <module>
import volum
ModuleNotFoundError: No module named 'volum'
In [2]: import volume
In [3]: runfile('/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/volume.py', wdir='/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20')
Reloaded modules: volume
74785.61311870502
In [4]: debugfile('/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/volume.py', wdir='/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20')
> /home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/volume.py(3)<module>()
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
----> 3 """
4 Created on Tue Oct 13 10:06:56 2020
5
ipdb> continue
> /home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/volume.py(11)<module>()
9 from math import pi
10
6--> 11 def volume_cilindro(raggio, altezza):
12 """Calcolo il volume di un cilindro di raggio e altezza dati \n
13 - raggio è un numero \n
ipdb> ?
Documented commands (type help <topic>):
========================================
EOF cl debug ignore n pp run unalias
a clear disable interact next psource rv undisplay
alias commands display j p q s unt
args complete down jump pdef quit skip_hidden until
b condition enable l pdoc r source up
break cont exit list pfile restart step w
bt continue h ll pinfo return tbreak whatis
c d help longlist pinfo2 retval u where
Miscellaneous help topics:
==========================
exec pdb
ipdb> p volume_cilindro
<function volume_cilindro at 0x7f99286a41f0>
ipdb> p area_cerchio
*** NameError: name 'area_cerchio' is not defined
ipdb> p area_cerchio
<function area_cerchio at 0x7f99286a44c0>
ipdb> p __name__
'__main__'
--Call--
--Call--
--Return--
--Return--
--Call--
ipdb> !debugfile('/opt/anaconda3/envs/F20/lib/python3.8/site-packages/ipykernel/iostream.py', wdir='/opt/anaconda3/envs/F20/lib/python3.8/site-packages/ipykernel')
74785.61311870502
ipdb>
In [5]: import volume
Traceback (most recent call last):
File "<ipython-input-5-8660d6cfc653>", line 1, in <module>
import volume
ModuleNotFoundError: No module named 'volume'
In [6]: import volume
In [7]: volume.area_cerchio(10)
Out[7]: 314.1592653589793
In [8]: from volume import *
In [9]: area_cerchio(100)
Out[9]: 31415.926535897932
In [10]: dir(volume)
Out[10]:
['__builtins__',
'__cached__',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__spec__',
'area_cerchio',
'pi',
'volume_cilindro',
'volume_cono']
In [11]: import volume
volume
In [12]: print(volume.volume_cilindro(43, 25))
145220.12041218817
In [13]: wiuyei = 75
In [14]: debugfile('/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/volume.py', wdir='/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20')
Reloaded modules: volume
--Call--
74785.61311870502
74785.61311870502
ipdb>
In [15]: debugfile('/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/volume.py', wdir='/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20')
--Call--
--Call--
--Return--
--Return--
--Call--
The current file cannot be closed because it is in debug mode.
The current file cannot be closed because it is in debug mode.
74785.61311870502
74785.61311870502
ipdb>
In [16]: import fattoriale
In [17]: debugfile('/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/fattoriale.py', wdir='/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20')
Reloaded modules: fattoriale
--Call--
--Call--
--Call--
--Return--
--Return--
--Return--
24
--Return--
--Return--
ipdb>
In [18]: import turtle
In [19]: t = turtle.Turtle()
In [20]: t.forward(100)
In [21]: t.left(90)
In [22]: t.forward(100)
In [23]: t.left(90)
In [24]: t.forward(100)
In [25]: t.left(90)
In [26]: t.forward(100)
In [27]: t.left(90)
In [28]: def quadrato(tarta, lato):
...: for i in range(4):
...: tarta.forward(lato)
...: tarta.left(90)
...:
In [29]: t.clear()
In [30]: quadrato(t, 200)
In [31]: t.clear()
In [32]: def albero(ruga, lunghezza, livello):
...: if livello == 0:
...: pass
...: else:
...: ruga.forward(lunghezza)
...: ruga.left(30)
...: albero(ruga, lunghezza*0.8, livello-1)
...: ruga.right(60)
...: albero(ruga, lunghezza*0.7, livello-1)
...: ruga.left(30)
...: ruga.bk(lunghezza)
...:
In [33]: albero(t, 100, 10)
In [34]: import random
...: def albero(ruga, lunghezza, livello):
...: if livello == 0:
...: pass
...: else:
...: ruga.pencolor(random.random(),
...: random.random(),random.random())
...: ruga.forward(lunghezza)
...: ruga.left(30)
...: albero(ruga, lunghezza*0.8, livello-1)
...: ruga.right(60)
...: albero(ruga, lunghezza*0.7, livello-1)
...: ruga.left(30)
...: ruga.bk(lunghezza)
...:
In [35]: t.clear()
In [36]: albero(t, 100, 5)
In [37]: import random
...: def albero(ruga, lunghezza, livello):
...: if livello == 0:
...: pass
...: else:
...: ruga.pencolor(random.random(),
...: random.random(),random.random())
...: ruga.pendown()
...: ruga.forward(lunghezza)
...: ruga.penup()
...: ruga.left(30)
...: albero(ruga, lunghezza*0.8, livello-1)
...: ruga.right(60)
...: albero(ruga, lunghezza*0.7, livello-1)
...: ruga.left(30)
...: ruga.bk(lunghezza)
...:
In [38]: t.clear()
In [39]: albero(t, 100, 5)
In [40]: import random
...: def albero(ruga, lunghezza, angolos, angolod, livello):
...: if livello == 0:
...: pass
...: else:
...: ruga.pencolor(random.random(),
...: random.random(),random.random())
...: ruga.pendown()
...: ruga.forward(lunghezza)
...: ruga.penup()
...: ruga.left(angolos)
...: albero(ruga, lunghezza*0.8, angolos,
...: angolod, livello-1)
...: ruga.right(angolos+angolod)
...: albero(ruga, lunghezza*0.7, angolos,
...: angolod, livello-1)
...: ruga.left(angolod)
...: ruga.bk(lunghezza)
...:
In [41]: t.clear()
In [42]: t.left(90)
In [43]: t.penup()
In [44]: t.bk(200)
In [45]: albero(t, 100, 30, 45, 5)
In [46]: t.clear()
In [47]: albero(t, 100, 15, 45, 5)
In [48]: albero(t, 100, 15, 60, 5)
In [49]: t = turtle.Turtle()
In [50]: albero(t, 100, 15, 60, 5)
In [51]: t.close()
Traceback (most recent call last):
File "<ipython-input-51-6f05ab01df51>", line 1, in <module>
t.close()
AttributeError: 'Turtle' object has no attribute 'close'
In [52]: def forse_dieta(peso, altezza, genere):
...: if genere == 'F':
...: if altezza > 170:
...: if peso > 80:
...: return True
...: else:
...: return False
...: else:
...: if peso > 50:
...: return True
...: else:
...: return False
...:
...: else:
...: if altezza > 180:
...: return (peso>100)
...: else:
...: return (peso>80)
...:
In [53]: forse_dieta(102, 186, 'M')
Out[53]: True
In [54]: import dieta
In [55]: dieta.forse_dieta(54, 175, 'F')
Out[55]: False
In [56]: dieta.forse_dieta(54, 175, 'F')
Out[56]: False
In [57]: %debug dieta.forse_dieta(54, 175, 'F')
NOTE: Enter 'c' at the ipdb> prompt to continue execution.
ipdb> q
In [58]: debugfile('/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/dieta.py', wdir='/home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20')
Reloaded modules: dieta
> /home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/dieta.py(3)<module>()
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
----> 3 """
4 Created on Tue Oct 13 12:53:17 2020
5
> /home/andrea/CORSI/F20/Lezioni/lezione03-13-10-20/dieta.py(8)<module>()
6 @author: andrea
7 """
8---> 8 def forse_dieta(peso, altezza, genere):
9 if genere == 'F':
10 if altezza > 170:
--Call--
--Return--
--Return--
--Return--
ipdb>
In [59]: