Discuss Scratch

Joshisaurio
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

Banner by NFlex23


Welcome to the official PyHelp forum, the Scratch's first Python help forum!
In this forum you can ask for questions on how to use Python, and I (And other people too) will try to help!

Tips:
  • Code: You can use this code in the forums to make your Python code have colors and make it easier to understand!
    Start your lines with:
    [code=py]

    print("Your code should go here")
    print("Make sure everything goes here!")

    Close it with:
    [/code]
  • Help. You can ask to be a helper to help me manage the forum, and help other people! Even if you're not a helper, feel free to try to help!
  • Don't be shy! Make sure to ask all your questions!
  • Be patient. It might take me a while to answer, don't worry, I'll make sure to check all of the posts, if I don't reply in a few days and you see me answering other posts, I probably missed your post, so please bump it and I'll reply!
  • Don't spam. This is annoying for people who are looking for answers, so please don't do it. The same thing for blockspamming and bumping, only bump your post if I don't reply
  • Have fun! Last, but not least, this forum was made to help people learning Python to improve their knowledge, so make sure to have all the fun you can!
Don't have Python? Here are some useful free code editors to start!
  • Python3 - IDLE - A very simple, but useful, code editor for beginners who are starting to learn Python! It is the official Python code editor, so I recommend it a lot for starters!
  • PyCharm - A very useful code editor for those who have more experience, it has a very good debugger and grammar corrector, and it keeps track of your variables and makes suggestions! I don't think beginners will find this features useful, because it is more designed for intermediate-advanced coder, so if you are on that level, make sure to check it out! I highly recommend it!
  • Replit - It is pretty similar to the official editor, it is commonly used for code hosting (For example to make servers in Scratch, check the Scratch connection libraries) and to make code with other people!
  • VS code - It is almost like PyCharm, one of the most useful functions is that you can code in other coding languages and you can also can share your code, it also has a very good debugger!
Scratch connection libraries to connect to Scratch!

Other useful Python libraries:
FAQ:
  • Q: Can I be a helper?
    A: Please tell your experience/IDE's/Programming Languages/An example program

  • Q: Why isn't my library (E.g. ScratchAttach) not working?
    A: Make sure that your library is on your computer by typing the same command pip install scratchattach into your terminal (If your IDE has one, use it, not the shell) and if it says that it's already in your computer, contact the PyHelp forum here! Also, if you're trying this:
    pip install scratchattach
    import scratchattach as scratch3
    scratch3.login("Joshisaurio", "123blahBlahBlahMypasswordlol(Not my real password)")
    
    That won't work, you have to type the pip command on your terminal.

    Still having trouble? Post your question in this forum!

Helper list:

Links and urls

Last edited by Joshisaurio (June 23, 2023 20:53:03)



Banner by @NFlex23


Banner by @NFlex23

kccuber
Scratcher
1000+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

Joshisaurio
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

kccuber wrote:

Duplicate of https://scratch.mit.edu/discuss/topic/7934/
No, one's just for discussing, this is especifically to ask help. Besides, if you post there it would be Necroposting, since it's from 2013… I feel we just need a newer one that focuses on helping people


Banner by @NFlex23


Banner by @NFlex23

Paddle2See
Scratch Team
1000+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

kccuber wrote:

Duplicate of https://scratch.mit.edu/discuss/topic/7934/
Well, that's the general Python topic. It could include providing help - but perhaps it makes sense to break help off into it's own topic? Particularly if the help topic were designed just for giving help and had a nice index to helpful resources on the first post or something? Just brainstorming here

Scratch Team Member, kayak and pickleball enthusiast, cat caregiver.

This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.
(credit to Za-Chary)



;
Joshisaurio
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

Paddle2See wrote:

kccuber wrote:

Duplicate of https://scratch.mit.edu/discuss/topic/7934/
Well, that's the general Python topic. It could include providing help - but perhaps it makes sense to break help off into it's own topic? Particularly if the help topic were designed just for giving help and had a nice index to helpful resources on the first post or something? Just brainstorming here
AaAaAaAa OMG it's a ST member AAAAAAAAAAAA lol yeah


Banner by @NFlex23


Banner by @NFlex23

Joshisaurio
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

(Deleted)

Last edited by Joshisaurio (June 28, 2022 23:15:32)



Banner by @NFlex23


Banner by @NFlex23

WindowsNTPowershell
Scratcher
4 posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

ayyy I use replit and code there
mmm2k
Scratcher
19 posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

This is very, very helpful!!

Try out my Sanrio clicker.
Try out my candy shop.
Try out my house simulator.
Joshisaurio
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

WindowsNTPowershell wrote:

ayyy I use replit and code there
Don't worry, Python is on Replit so I can help anyway


Banner by @NFlex23


Banner by @NFlex23

Joshisaurio
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

mmm2k wrote:

This is very, very helpful!!
Thanks!


Banner by @NFlex23


Banner by @NFlex23

bluepig600
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

May I be a helper?

#imwithukraine
I used to work at
78CH3'S EVERYTHING SHOP
YOUR ORDERS, OUR SERVICE!

Go check us out!
(I feel bad for not being active there so I'm leaving this advert for the shop.)


Credit for the banner goes to @just-there
Joshisaurio
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

bluepig600 wrote:

May I be a helper?
Sure!


Banner by @NFlex23


Banner by @NFlex23

mzarony0
Scratcher
48 posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

How can I make python itself create a new variable?

ex. every time I press ‘x’, it automatically creates a new var like x, x1, x2, x3 etc. and I don't have to manually type
x=1
x1=1
x2=1
etc.

Thanks!

It's easy to play any musical instrument: all you have to do is touch the right key at the right time and the instrument will play itself.
-Bach
have a nice day

Dinosu
Scratcher
77 posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

mzarony0 wrote:

How can I make python itself create a new variable?

ex. every time I press ‘x’, it automatically creates a new var like x, x1, x2, x3 etc. and I don't have to manually type
x=1
x1=1
x2=1
etc.

Thanks!

I don't think this is possible, but if you want to do something like that, you should use a list. For instance, if you wanted x to be 1, x1 to be 2, and x2 to be 3, you could create a list that looks like this:

my_list = [1, 2, 3]

To add a new item, such as 4, to the list, you could do

my_list.append(4)

And to get the n-th item of the list, you could do this:

my_list[n]

I recommend referring to this website for more help.
Joshisaurio
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

mzarony0 wrote:

How can I make python itself create a new variable?

ex. every time I press ‘x’, it automatically creates a new var like x, x1, x2, x3 etc. and I don't have to manually type
x=1
x1=1
x2=1
etc.

Thanks!
I think there's no function to do that right now, I think you CAN do something similar with functions, but you can't do something like that with variables. An easy workaround is to use a dictionary:
Values = {}
for i in range(0, 10): #The 10 is an example, you can use the amount of variables that you want
   Values["x"+ str(i)] = "Value" #The "x" + str(i) adds them up, so if i = 2, it will make a key named x2
#To access your dictionary's keys, you can do this:
Values[x2] #This is an example
#To view everything, type this in:
Values
#To add a value, do this:
Values["KeyName"] = "Value"
I hope I helped!

Last edited by Joshisaurio (June 29, 2022 01:46:56)



Banner by @NFlex23


Banner by @NFlex23

Joshisaurio
Scratcher
100+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

Dinosu wrote:

mzarony0 wrote:

~Snipped question~
~Snipped reply~
Ahahah I took me a while to type in haha you did it before me! Your way is also pretty efficient! Also do you want to be a helper?

Last edited by Joshisaurio (June 29, 2022 01:45:48)



Banner by @NFlex23


Banner by @NFlex23

Pau-pauMarcos
Scratcher
55 posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

Joshisaurio wrote:

PyHelp Forum
Welcome to the official PyHelp forum, the Scratch's first Python help forum!
In this forum you can ask for questions on how to use Python, and I'll try to help!
Tips:
  • Code: You can use this code (Without the #) in the forums to make your Python code have colors and make it easier to understand!
    #Start your lines with:
    #[code=py]
    print("Your code should go here")
    #Close it with:
    #[/code]
    
  • Help. You can ask to be a helper to help me manage the forum, and help other people! Even if you're not a helper, feel free to try to help!
  • Don't be shy! Make sure to ask all your questions!
  • Be patient. It might take me a while to answer, don't worry, I'll make sure to check all of the posts, if I don't reply in a few days and you see me answering other posts, I probably missed your post, so please bump it and I'll reply!
  • Don't spam. This is annoying for people who are looking for answers, so please don't do it. The same thing for blockspamming and bumping, only bump your post if I don't reply
  • Have fun! Last, but not least, this forum was made to help people learning Python to improve their knowledge, so make sure to have all the fun you can!

Code editor list:
  • PyCharm
  • Replit

Helper list:
LOL

Hello Everybody! My Name Is Pau-pauMarcos, I am A Youtuber/Scratcher/Actor !!! I Like Making Scratch Projects During My Free Time! If You Have Anything To ask About me, Don't Hesitate To Message My Help Center @Pau-pauMarcoshelpcen ! Scratch On!
applejuiceproduc
Scratcher
1000+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

Can I help

A signature
rishi272011
Scratcher
91 posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

mzarony0 wrote:

How can I make python itself create a new variable?

ex. every time I press ‘x’, it automatically creates a new var like x, x1, x2, x3 etc. and I don't have to manually type
x=1
x1=1
x2=1
etc.

Thanks!
This could be the code you were thinking about if you are using dictionaries:

#creating an empty dictionary
variables = {}
#creating a variable to find out number of dictionary entries
num = 0
#creating a function to add vars to dict
def create_var(varname, value):
    variables[varname] = value
def delete_var(varname):
    try:
        variables.pop(varname)
    except KeyError:
        return("variable not found")
if True == True:#change this condition to whatever condition you need
    create_variable("x" + str(num), randint(1, 10))#change the randint to whatever value needed
    num += 1
#
mybearworld
Scratcher
1000+ posts

PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |

mzarony0 wrote:

(#13)
How can I make python itself create a new variable?

ex. every time I press ‘x’, it automatically creates a new var like x, x1, x2, x3 etc. and I don't have to manually type
x=1
x1=1
x2=1
etc.

Thanks!
The currently given answers are good and should definetely be used instead of this one, but if you really want that literally:
for i in range(10):
    exec(f"x{i} = {i}")
print(x8)
print(x3)

Signatures are the only place where assets links still work.

Powered by DjangoBB