This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-04-17 19:52:58

TheBlueRocky
Scratcher
Registered: 2010-07-08
Posts: 500+

Python Programming Language

I love Python. I am working on a pet that you can care for and so far I have 440+ lines of script done.  big_smile

What things in Python have you made? Post your scripts. I'd love to play some games or apps you made.  smile

Offline

 

#2 2011-04-17 19:58:23

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Re: Python Programming Language

I'm learning Python from a book, but I'm no good. Any pointers?

Offline

 

#3 2011-04-17 20:06:55

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: Python Programming Language

urhungry wrote:

Any pointers?

No, I do not believe Python really uses pointers.  tongue

Offline

 

#4 2011-04-17 20:10:54

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Python Programming Language

Zelda123 wrote:

urhungry wrote:

Any pointers?

No, I do not believe Python really uses pointers.  tongue

I see what you did there.  tongue

I use Python, although I haven't done much with it.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#5 2011-04-17 20:23:36

TheBlueRocky
Scratcher
Registered: 2010-07-08
Posts: 500+

Re: Python Programming Language

Basics:

It's alot like Scratch. Think of it as one large Scratch script but the blocks are written as lines of script.

Making a variable:

Code:

variablename = value

If the value is a word, put the value in apostraphes. If it's a list, place brackets like this:

Code:

listname = ['item1','item2']

Forever block:

The forever block doesn't exist, but you can do this.

Create a variable called anything you want. Set it to any number.
Use a while (repeat until) to do this:

Code:

while variablename == value:

Note:

When setting a value, use =. If checking equality between variables or just one, use an ==. An != means does not equal.
At the end of an if or while, use a : at the end.
Anything inside a "block" has a tab in front of it.

Ifs are used like this:

Code:

if (whatever):

You can use an else like this:

Code:

if (whatever):
     (whatever)
else:

Print just displays a message. This is how it's used:

Code:

print("insert message here")

That's all for now. I'll post more later!  smile  I hope that helped.

Offline

 

#6 2011-04-17 20:36:11

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Python Programming Language

I do have it, but I do very little with it.  I'm still working on making sure pygame works.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#7 2011-04-17 20:41:01

thebuilderdd
Scratcher
Registered: 2008-01-26
Posts: 1000+

Re: Python Programming Language

For Python, check out the Pyython Library in Advanced Topics!

Offline

 

#8 2011-04-18 17:33:23

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: Python Programming Language

I made PY-DOS. I recently remembered about it, and it doesn't work on the command line in Python 3.2. Only IDLE.  mad

It would be nice if somebody could help me out with my problem.

Last edited by ThePCKid (2011-04-18 17:34:12)

Offline

 

#9 2011-04-18 17:40:26

poopo
Scratcher
Registered: 2009-09-20
Posts: 1000+

Re: Python Programming Language

I don't know how to do graphics.  sad


http://i45.tinypic.com/28rnqki.jpg

Offline

 

#10 2011-04-18 17:43:42

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: Python Programming Language

poopo wrote:

I don't know how to do graphics.  sad

Can you please try to fix my problem (above)?

Oh yeah, try pygame for graphics. You need 2.x for pygame.

Last edited by ThePCKid (2011-04-18 17:44:21)

Offline

 

#11 2011-04-18 17:44:36

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Python Programming Language

ThePCKid wrote:

poopo wrote:

I don't know how to do graphics.  sad

Can you please try to fix my problem (above)?

I think it was because you used 'input('')' rather than 'raw_input('')'


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#12 2011-04-18 18:02:44

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: Python Programming Language

ssss wrote:

ThePCKid wrote:

poopo wrote:

I don't know how to do graphics.  sad

Can you please try to fix my problem (above)?

I think it was because you used 'input('')' rather than 'raw_input('')'

Nope.

Code:

Traceback (most recent call last):
  File "C:\Users\Owner\Desktop\Hunter\0Pythonstuff\fakeos.py", line 81, in <module>
    username = str(raw_input("Enter your desired username: "))
NameError: name 'raw_input' is not defined

Offline

 

#13 2011-04-18 21:25:29

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Python Programming Language

ssss wrote:

ThePCKid wrote:

poopo wrote:

I don't know how to do graphics.  sad

Can you please try to fix my problem (above)?

I think it was because you used 'input('')' rather than 'raw_input('')'

No 'input()' should work fine, although it's not really necessary to tell it to convert to a string, since 'input()' converts the input to the appropriate type of data anyway.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer