Discuss Scratch

mumu245
Scratcher
1000+ posts

Python programming language

UnscrambledEgg wrote:

mybearworld wrote:

UnscrambledEgg wrote:

(#936)

mybearworld wrote:

UnscrambledEgg wrote:

print(“Hello world!”) is always deleted like Sprite 1.
If you don't need it, you never type in the first place
Every time you open a script it just places that in the script by default
What IDE are you using? I'm using VSCode and it doesn't do that, and neither does IDLE. That seems like a very useless feature…
no I'm too embarrassed to say
PyCharm? I use it too
But… can you even be embarrassed by using PyCharm?

select this text then press Ctrl+Shift+Down to read more
BreadcatGames
Scratcher
1000+ posts

Python programming language

mumu245 wrote:

UnscrambledEgg wrote:

mybearworld wrote:

UnscrambledEgg wrote:

(#936)

mybearworld wrote:

UnscrambledEgg wrote:

print(“Hello world!”) is always deleted like Sprite 1.
If you don't need it, you never type in the first place
Every time you open a script it just places that in the script by default
What IDE are you using? I'm using VSCode and it doesn't do that, and neither does IDLE. That seems like a very useless feature…
no I'm too embarrassed to say
PyCharm? I use it too
But… can you even be embarrassed by using PyCharm?
Pycharm is based
Knightbot63
Scratcher
1000+ posts

Python programming language

I don't get the min() function.
lb = ["5", "2", "5234", "112",]
print(min(lb))
It reports 112 but the lowest is 2

Working on an RPG. Consistently losing followers because of inactivity.
I head to forums time-to-time. Not as much as I used to.
imfh
Scratcher
1000+ posts

Python programming language

Knightbot63 wrote:

I don't get the min() function.
lb = ["5", "2", "5234", "112",]
print(min(lb))
It reports 112 but the lowest is 2
That’s because you have a list of strings, not numbers. Text is sorted alphabetically, so “112” comes first. You would find that “1119” is smaller than “112” since “1” comes before “2” alphabetically.

Try converting everything in the list to a number first with map:
lb = ["5", "2", "5234", "112",]
print(min(map(int, lb)))

Last edited by imfh (Feb. 28, 2023 23:33:50)


Scratch to Pygame converter: https://scratch.mit.edu/discuss/topic/600562/
UnscrambledEgg
Scratcher
100+ posts

Python programming language

mrcoat wrote:

UnscrambledEgg wrote:

no I'm too embarrassed to say







Too embarrassed? Now I really want to know
Never mind I changed lol
gosoccerboy5
Scratcher
1000+ posts

Python programming language

I wrote some js recently and i struggled because I kept writing python syntax lmao

UnscrambledEgg
Scratcher
100+ posts

Python programming language

mumu245 wrote:

UnscrambledEgg wrote:

mybearworld wrote:

UnscrambledEgg wrote:

(#936)

mybearworld wrote:

UnscrambledEgg wrote:

print(“Hello world!”) is always deleted like Sprite 1.
If you don't need it, you never type in the first place
Every time you open a script it just places that in the script by default
What IDE are you using? I'm using VSCode and it doesn't do that, and neither does IDLE. That seems like a very useless feature…
no I'm too embarrassed to say
PyCharm? I use it too
But… can you even be embarrassed by using PyCharm?
No it wasn't Pycharm, anyways I changed
gilbert_given_189
Scratcher
500+ posts

Python programming language

So, do you like to break the convention?
class A:
	foo = 1
	bar = 2
	
	# make everything into a read-only property
	def read_only(_locals=locals()):
		for name, value in _locals.items():
			if name.startswith("__"): continue
			_locals[name] = property(fget=lambda self: value)
	read_only()
	del read_only
test = A()
print(test.foo)
print("read_only" in dir(test))
test.bar = 3

If you see a line above this text, it means that below this text is my signature.
This place is just a memory to me, I may return occasionally but I'm busy.
I guess I'm an ATer now.

I think I may have seasoned my posts a bit too much.
Also, my posts are getting lengthy lately. Whoops.


Colored Pencil is supposed to color the siggy, but Scratch says it's too big.


There is nothing here…



don don pan pan
dondo pan pan
StarscreamClone
Scratcher
1000+ posts

Python programming language

Gosh, I have to write an AI agent in Common Lisp for a semester-long project and I really miss Python right now - Lisp does NOT like strings

Saw some discussion on IDEs - Pycharm's my go-to IDE, and if you've got a verifiable student email, you can get Pycharm Professional for free!

Somewhere in my 20s | He/It
Workin' on my degree in computer science and cognitive science, and the future president of 2036!

Surge is my imaginary husband - he's the guy in my icon!
k0d3rrr
Scratcher
1000+ posts

Python programming language

What is a circular import? I keep trying to import the winsound library, but every single time I do that, it says:
AttributeError: partially initialized module ‘winsound’ has no attribute ‘PlaySound’ (most likely due to a circular import)
(I'm using the example script from the Python documentation.)


Animated button created by me


Despite what my About section says, I have been using Scratch before 2019. 2019 was the year that I first joined Scratch.
gilbert_given_189
Scratcher
500+ posts

Python programming language

k0d3rrr wrote:

What is a circular import? I keep trying to import the winsound library, but every single time I do that, it says:
AttributeError: partially initialized module ‘winsound’ has no attribute ‘PlaySound’ (most likely due to a circular import)
(I'm using the example script from the Python documentation.)
# a.py
import b
# b.py
import a
If you got that on a builtin Python module, your Python install may be borked.

If you see a line above this text, it means that below this text is my signature.
This place is just a memory to me, I may return occasionally but I'm busy.
I guess I'm an ATer now.

I think I may have seasoned my posts a bit too much.
Also, my posts are getting lengthy lately. Whoops.


Colored Pencil is supposed to color the siggy, but Scratch says it's too big.


There is nothing here…



don don pan pan
dondo pan pan
k0d3rrr
Scratcher
1000+ posts

Python programming language

gilbert_given_189 wrote:

k0d3rrr wrote:

What is a circular import? I keep trying to import the winsound library, but every single time I do that, it says:
AttributeError: partially initialized module ‘winsound’ has no attribute ‘PlaySound’ (most likely due to a circular import)
(I'm using the example script from the Python documentation.)
# a.py
import b
# b.py
import a
If you got that on a builtin Python module, your Python install may be borked.
I entered “module” into the Python shell, and it includes Winsound in there. (I'm using Python 3.10.4 by the way.)


Animated button created by me


Despite what my About section says, I have been using Scratch before 2019. 2019 was the year that I first joined Scratch.
GoldenAlbans
Scratcher
55 posts

Python programming language

What are good books that teach you how to program Raspberry Pi’s with Python.

I’m not much on speeches. That’s all.

GoldenAlbans The Great wrote:

People don’t usually put quotes in signatures.
Follow @GoldenAlbans!
Maximouse
Scratcher
1000+ posts

Python programming language

k0d3rrr wrote:

What is a circular import? I keep trying to import the winsound library, but every single time I do that, it says:
AttributeError: partially initialized module ‘winsound’ has no attribute ‘PlaySound’ (most likely due to a circular import)
(I'm using the example script from the Python documentation.)
The most common reason for that error is trying to import the module from a file named “winsound.py”. Python searches the current directory first when looking for a module to import.


This is Maximouse's signature. Learn more about signatures.
marsmark
Scratcher
60 posts

Python programming language

Learning Java right now, really misses Python.

My Projects

Scratch++ | Interpreted coding Engine
An introductory text-based programming language made in Scratch; designed for experienced scratchers; that transforms scratch blocks into text form.
UnscrambledEgg
Scratcher
100+ posts

Python programming language

Is there a way to save images of codes from Jupyter?
UnscrambledEgg
Scratcher
100+ posts

Python programming language

20% of this forum are users complaining about how they're in University working on a long term project that requires a foreign language from Python and how they miss programming with it.
mrcoat
Scratcher
100+ posts

Python programming language

I made a scratch project thumbnail loader: https://scratch.mit.edu/projects/827525110 It has ton of bugs, but am still proud of it.

My cartoon
Watch My Show!
I was gonna put an image of the studio but it didn't work.

Cool thing I made
when [Awesomeness v] > (100)
forever
play sound [Victory v] until done
set rotation style [The best style v]
go to [The party v]
end
Knightbot63
Scratcher
1000+ posts

Python programming language

bump.

What's so great about “self” in classes, Besides the fact that you can go outside of the class function.

Working on an RPG. Consistently losing followers because of inactivity.
I head to forums time-to-time. Not as much as I used to.
mybearworld
Scratcher
1000+ posts

Python programming language

Knightbot63 wrote:

(#959)
bump.

What's so great about “self” in classes, Besides the fact that you can go outside of the class function.
…you can go outside of the class function. That's what it does. That's like saying “What's so great about food? Besides the fact that you can eat it.”

Signatures are the only place where assets links still work.

Powered by DjangoBB