Untitled
unknown
plain_text
a year ago
1.1 kB
24
Indexable
# function add two numbers def sum(num1,num2): print(num1+num2) sum(5,7) #i=0 i<5 P #i=1 i<5 P #i=2 i<5 P #i=3 i<5 P #i=4 i<5 P for i in range (3): print (i) for i in range (2,7,2): print (i) # 2 4 6 for i in range (0,-5,-1): print (i) # 0 -1 -2 -3 -4 while True: print('Hello python') i=0 #i=0 i<3 P #i=1 i<3 P #i=2 i<3 P #i=3 i<3 False while i<3: print ('hello') i=i+1 for i in range(10): print("hello") i=0 while i<10: print ("hello") i=i+1 from mblock import event import time @event.greenflag def on_greenflag(): sprite.set_variable('P1Health', 100) sprite.set_costume('Idle') while True: if sprite.is_keypressed('right arrow'): move(10) if sprite.is_keypressed('left arrow'): move(-10) def move(dirction): sprite.change_x_by(dirction) sprite.set_costume('Walk1') time.sleep(0.03) sprite.set_costume('Walk2') time.sleep(0.03) sprite.set_costume('Walk3') time.sleep(0.03) sprite.set_costume('Idle')
Editor is loading...
Leave a Comment