Python beginners rus

From Wiki

Jump to: navigation, search

Contents

part 1

source code

5+5==10

return True

5+5==5

return False


if 4*4 == 16:
   print " super "
else:
   print " bad "

return super


if 5+5==15:
   print " super "
else:
   pinrt " bad"

return bad


Angela * 4

returns an error

Enlarge
" Angela " * 150

returns Angela 150 times in a pretty pattern (see picture at the right)

part 2

source code

import xturtle

for x in range(20):
  xturtle.fd(60)
  xturtle.left(60)

Note: You can replace xturtle with turtle. If you do so, use turtle.forward(distance) instead of xturtle.fd(distance)

Personal tools