Python 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 21:52:21)

Type "copyright", "credits" or "license" for more information.


IPython 7.8.0 -- An enhanced Interactive Python.


In [1]: intero = 10


In [2]: intero

Out[2]: 14


In [3]: 3*5

Out[3]: 15


In [4]: "testo di prova"

Out[4]: 'testo di prova'


In [5]: "un'amazzone"

Out[5]: "un'amazzone"


In [6]: ' tizio ha detto: "lkshgfljhdlh" e poi basta'

Out[6]: ' tizio ha detto: "lkshgfljhdlh" e poi basta'


In [7]: " \" "

Out[7]: ' " '


In [8]: " \\ "

Out[8]: ' \\ '


In [9]: testo = "kgjhgjhgjhgkjhfktuyfk

File "<ipython-input-9-475aece7c9fa>", line 1

testo = "kgjhgjhgjhgkjhfktuyfk

^

SyntaxError: EOL while scanning string literal



In [10]:


In [10]: testo = "kgjhgjhgjhgkjhfktuyfk"


In [11]: len(testo)

Out[11]: 21


In [12]: testo + " ljhdskfjhgk"

Out[12]: 'kgjhgjhgjhgkjhfktuyfk ljhdskfjhgk'


In [13]: x = "uiop"


In [14]: y = "uiop"


In [15]: id(x)

Out[15]: 140250282309200


In [16]: id(y)

Out[16]: 140250282309200


In [17]: y = 'kuweytiu'


In [18]: id(y)

Out[18]: 140250281965104


In [19]: 2^100

Out[19]: 102


In [20]: 2**100

Out[20]: 1267650600228229401496703205376


In [21]: 2**1000

Out[21]: 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376


In [22]: 2**10000

Out[22]: 19950631168807583848837421626835850838234968318861924548520089498529438830221946631919961684036194597899331129423209124271556491349413781117593785932096323957855730046793794526765246551266059895520550086918193311542508608460618104685509074866089624888090489894838009253941633257850621568309473902556912388065225096643874441046759871626985453222868538161694315775629640762836880760732228535091641476183956381458969463899410840960536267821064621427333394036525565649530603142680234969400335934316651459297773279665775606172582031407994198179607378245683762280037302885487251900834464581454650557929601414833921615734588139257095379769119277800826957735674444123062018757836325502728323789270710373802866393031428133241401624195671690574061419654342324638801248856147305207431992259611796250130992860241708340807605932320161268492288496255841312844061536738951487114256315111089745514203313820202931640957596464756010405845841566072044962867016515061920631004186422275908670900574606417856951911456055068251250406007519842261898059237118054444788072906395242548339221982707404473162376760846613033778706039803413197133493654622700563169937455508241780972810983291314403571877524768509857276937926433221599399876886660808368837838027643282775172273657572744784112294389733810861607423253291974813120197604178281965697475898164531258434135959862784130128185406283476649088690521047580882615823961985770122407044330583075869039319604603404973156583208672105913300903752823415539745394397715257455290510212310947321610753474825740775273986348298498340756937955646638621874569499279016572103701364433135817214311791398222983845847334440270964182851005072927748364550578634501100852987812389473928699540834346158807043959118985815145779177143619698728131459483783202081474982171858011389071228250905826817436220577475921417653715687725614904582904992461028630081535583308130101987675856234343538955409175623400844887526162643568648833519463720377293240094456246923254350400678027273837755376406726898636241037491410966718557050759098100246789880178271925953381282421954028302759408448955014676668389697996886241636313376393903373455801407636741877711055384225739499110186468219696581651485130494222369947714763069155468217682876200362777257723781365331611196811280792669481887201298643660768551639860534602297871557517947385246369446923087894265948217008051120322365496288169035739121368338393591756418733850510970271613915439590991598154654417336311656936031122249937969999226781732358023111862644575299135758175008199839236284615249881088960232244362173771618086357015468484058622329792853875623486556440536962622018963571028812361567512543338303270029097668650568557157505516727518899194129711337690149916181315171544007728650573189557450920330185304847113818315407324053319038462084036421763703911550639789000742853672196280903477974533320468368795868580237952218629120080742819551317948157624448298518461509704888027274721574688131594750409732115080498190455803416826949787141316063210686391511681774304792596709376


In [22]:


In [23]: 2+3*4

Out[23]: 14


In [24]: (2+3)*4

Out[24]: 20


In [25]: def are4_rett4ng0lo( base, altezza):

    ...: return base * altezza

    ...:


In [26]: are4_rett4ng0lo(10, 40)

Out[26]: 400


In [27]: def are4_rett4ng0lo( base, altezza):

    ...: base * altezza

    ...:


In [28]: are4_rett4ng0lo(10, 40)


In [29]: def are4_rett4ng0lo( base, altezza):

    ...: return base * altezza

    ...:


In [30]: are4_rett4ng0lo(10, 40)

Out[30]: 400


In [31]: b= input()


shfjbalksjhflgak


In [32]: b

Out[32]: 'shfjbalksjhflgak'


In [33]: 10 * 3

Out[33]: 30


In [34]: '10'*3

Out[34]: '101010'


In [35]: are4_rett4ng0lo('shdgfj', 4)

Out[35]: 'shdgfjshdgfjshdgfjshdgfj'


In [36]: 'kwrjhfgk' * ",jhkjhkhj"

Traceback (most recent call last):


File "<ipython-input-36-93dbc1f5478e>", line 1, in <module>

'kwrjhfgk' * ",jhkjhkhj"


TypeError: can't multiply sequence by non-int of type 'str'



In [37]:


In [37]: 3 * "kgjjhgjhg"

Out[37]: 'kgjjhgjhgkgjjhgjhgkgjjhgjhg'


In [38]: runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')

area:1000


In [39]: runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')

area:!1000


In [40]: runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')

area:!1000



lfdkjhglksjdhg


In [41]: runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')

area: 1000


Dammi la base (intero)24


Dammi l'altezza (intero)45

Traceback (most recent call last):


File "<ipython-input-41-f08d88e98431>", line 1, in <module>

runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')


File "/opt/anaconda3/envs/F19/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile

execfile(filename, namespace)


File "/opt/anaconda3/envs/F19/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile

exec(compile(f.read(), filename, 'exec'), namespace)


File "/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py", line 23, in <module>

print('L\'area è', are4_rett4ng0lo(b,a))


File "/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py", line 21, in are4_rett4ng0lo

return base * altezza


TypeError: can't multiply sequence by non-int of type 'str'



In [42]:


In [42]: runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')

area: 1000


Dammi la base (intero)34


Dammi l'altezza (intero)67

L'area è 2278

Traceback (most recent call last):


File "<ipython-input-42-f08d88e98431>", line 1, in <module>

runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')


File "/opt/anaconda3/envs/F19/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile

execfile(filename, namespace)


File "/opt/anaconda3/envs/F19/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile

exec(compile(f.read(), filename, 'exec'), namespace)


File "/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py", line 25, in <module>

print("base:", base)


NameError: name 'base' is not defined



In [43]:


In [43]: runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')

area: 1000


Dammi la base (intero)34


Dammi l'altezza (intero)67

L'area è 2278


In [44]: runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')

area: 1000


Dammi la base (intero)kdjgfhlksjhl

Traceback (most recent call last):


File "<ipython-input-44-f08d88e98431>", line 1, in <module>

runfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')


File "/opt/anaconda3/envs/F19/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile

execfile(filename, namespace)


File "/opt/anaconda3/envs/F19/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile

exec(compile(f.read(), filename, 'exec'), namespace)


File "/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py", line 17, in <module>

b = int(input("Dammi la base (intero)"))


ValueError: invalid literal for int() with base 10: 'kdjgfhlksjhl'



In [45]:


In [45]: debugfile('/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py', wdir='/home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni')

> /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(7)<module>()

5

6 @author: andrea

----> 7 """

8

9



ipdb> > /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(10)<module>()

8

9

---> 10 intero = 10

11

12 b = 25



ipdb>

ipdb> > /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(12)<module>()

10 intero = 10

11

---> 12 b = 25

13 a = 40

14



ipdb> > /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(13)<module>()

11

12 b = 25

---> 13 a = 40

14

15 print("area:", b*a )



ipdb> > /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(15)<module>()

13 a = 40

14

---> 15 print("area:", b*a )

16

17 b = int(input("Dammi la base (intero)"))



ipdb> area: 1000

> /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(17)<module>()

15 print("area:", b*a )

16

---> 17 b = int(input("Dammi la base (intero)"))

18 a = int(input("Dammi l'altezza (intero)"))

19



ipdb>

ipdb>

Dammi la base (intero)4656

> /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(18)<module>()

16

17 b = int(input("Dammi la base (intero)"))

---> 18 a = int(input("Dammi l'altezza (intero)"))

19

20 def are4_rett4ng0lo( base, altezza):



ipdb>

Dammi l'altezza (intero)33

> /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(20)<module>()

18 a = int(input("Dammi l'altezza (intero)"))

19

---> 20 def are4_rett4ng0lo( base, altezza):

21 return base * altezza

22


> /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(23)<module>()

21 return base * altezza

22

---> 23 print('L\'area è', are4_rett4ng0lo(b,a))

24

25 # print("base:", base)



ipdb> --Call--

> /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(20)are4_rett4ng0lo()

18 a = int(input("Dammi l'altezza (intero)"))

19

---> 20 def are4_rett4ng0lo( base, altezza):

21 return base * altezza

22



ipdb> > /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(21)are4_rett4ng0lo()

19

20 def are4_rett4ng0lo( base, altezza):

---> 21 return base * altezza

22

23 print('L\'area è', are4_rett4ng0lo(b,a))



ipdb> --Return--

153648

> /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(21)are4_rett4ng0lo()

19

20 def are4_rett4ng0lo( base, altezza):

---> 21 return base * altezza

22

23 print('L\'area è', are4_rett4ng0lo(b,a))



ipdb> --Call--

> /opt/anaconda3/envs/F19/lib/python3.7/site-packages/ipykernel/iostream.py(384)write()

382 parent=self.parent_header, ident=self.topic)

383

--> 384 def write(self, string):

385 if self.echo is not None:

386 try:



ipdb> L'area è--Return--

None

> /opt/anaconda3/envs/F19/lib/python3.7/site-packages/ipykernel/iostream.py(410)write()

408 self.flush()

409 else:

--> 410 self._schedule_flush()

411

412 def writelines(self, sequence):



ipdb> 153648

--Return--

None

> /home/andrea/Documents/Uni/Didattica/Prog1/2019-20/Lezioni/lezione1.py(23)<module>()

21 return base * altezza

22

---> 23 print('L\'area è', are4_rett4ng0lo(b,a))

24

25 # print("base:", base)



ipdb> --Return--


ipdb>


In [46]: