Discuss Scratch

MarioBrosU22
Scratcher
100+ posts

Using my python knowledge to convert python to scratch

So, recently i have learnt python and made a few programs, then i thought of this, coverting python to scratch.
MarioBrosU22
Scratcher
100+ posts

Using my python knowledge to convert python to scratch

Heres a basic python script for getting a users birth year that i made:

#Get the birth date of someone

import datetime

year = datetime.date.today().year

print('Your birth year is ‘, year - int(input(’How old are you? ')))


Here is the scratch version

When flag clicked
set [year v] to (current[year v])
ask(How old are you?) and wait
add (join (Your birth year is ) ((year) - (answer))) to [console v]

Last edited by MarioBrosU22 (May 3, 2021 17:55:56)

o-y
Scratcher
24 posts

Using my python knowledge to convert python to scratch

This is interesting…

import time
x = 5 **2
x += 5
time.sleep(1)
print (x)

is the same as:

Last edited by o-y (May 3, 2021 19:08:47)

Powered by DjangoBB