Wednesday, December 30, 2015

python programming

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> print(7*2+4)
18
>>> ================================ RESTART ================================
>>> width=7
>>> height=4
>>> print(height*2+width*2)#perimeter
22
>>> print(length*width)#area
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    print(length*width)#area
NameError: name 'length' is not defined
>>> print(Width*height)#aea
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    print(Width*height)#aea
NameError: name 'Width' is not defined
>>>  print(width*height)

SyntaxError: unexpected indent
>>> print(width*height)#area
28
>>> width
7
>>> 5%2
1
>>> g=float(pi)+pi
Traceback (most recent call last):
  File "<pyshell#10>", line 1, in <module>
    g=float(pi)+pi
NameError: name 'pi' is not defined
>>> pi=3.5
>>> g=float(pi)
>>> g
3.5
>>> g=int(pi)
>>> g
3
>>> 11//2
5
>>> 11.0//2.0
5.0
>>> 11/2.0
5.5
>>> 11//2.0
5.0
>>> g=8
>>> g+=2
>>> g=
SyntaxError: invalid syntax
>>> g
10
>>> x=40
>>> x==40
True
>>> 40=x
SyntaxError: can't assign to literal
>>> x==45
False
>>> 3**2
9
>>> x=20
>>> x*=3
>>> x
60
>>> x==59
False
>>> x!=59
True
>>> ================================ RESTART ================================
>>> 32
32
>>> ================================ RESTART ================================
>>> 30+50*10
530
>>> (30+50)*10
800
>>> ================================ RESTART ================================
>>> #this says hello
>>> '''hi again this along '''
'hi again this along '
>>> hey how are you doing""
SyntaxError: invalid syntax
>>> 6/10
0.6
>>>

No comments:

Post a Comment