Rainbow Lion
@RainBowLion1
Dogs Are Pretty Pog (And Rainbows)
for my game i want for you to be able to get a password and if you put in that password you go back to were you are is this posible if so how can i do
sojs yes, @Bunnytoes idea would work.
save where they are currently, then when they enter a password, check if its correct, if it is, the bring them back to were they were2 years ago
Bunnytoes Create a secret, then make it if they enter the secret they do what you want, hope this helps :)(if you want anymore help just ping me) if this helped feel free to mark as answer :)2 years ago
i want to print a list thats in a list but i get a the error TypeError: 'int' object is not subscriptable is this posible if so how can i do it
InvisibleOne Yeah, I did that same mistake my first time, do this:
list = [["list", 'Of', 'lists'], ['another', 'list', 'in', 'a', 'iist']]
data = list0
print(data)
you have it like this: list0[0]] when it should be list[02 years ago
i want to import a file that is in a folder and well thats it how do i do this?
ok i have 10 vars for example there called test_1 - 10 i want to switch between them maybe my adding or decresing a number is this posible/ whats the
Coder100 Use an array.
arr = [1, 2, 3]
arr[0] # 1
arr[1] # 2
arr[2] # 3
Arrays start at 0 so don't forget that2 years ago
MocaCDeveloper There is no easy way to do this.
You're just gonna have to commit an action on each var separately.
Meaning, if you want to increment them all, you have to do:
test_1++;
test_2++;
test_3++;
...
If you're in Python then change the ++ to a +=12 years ago
ok i want to have a code change what its changing depending on a number so i have 10 vars named line1 - line10 right now i have it so it says: number
Hello i want to make a code that makes a certain about of variable depending on the number i give it also with a prefix like "number1" or "line3". is
btfuss @RainBowLion1
Better idea:
Use the exec function!
Here is a template function:
function createVar(name, amount, value):
for index in range(1, amount+1): #this makes it so it starts at 1
exec(f'{name}_{index} = "{value}"' #or check if the value isnt a string
Amount = Amount of variables with extra names
Name = The name of the original variable!
Value = The value of the variable2 years ago
InvisibleOne You could just put all the values in a list and access them by indexing, but no, there isn't really a way to do what you want to, at least not a 'good' way.
However, as a master of Jank I know some little tricks to get the job done.
First, you need to put all the 'variables' you are creating into a multiline string, I'm assuming that their values will be the same for all of them initially.
i = int(input("How many vars do you want: ")
name = input("Name: ")
val = input("Value: ")
vars = """"""
2 years ago
ok so i want a way to delay somthing BUT not stop the rest of the code it is in a example
def go():
print("Part 1")
#time.sleep(2)
print("Part 2
RYANTADIPARTHI use threading. Here's a tutorial.
https://realpython.com/intro-to-python-threading/2 years ago
InvisibleOne To do this in python, you need to use multithreading.
example
def say():
while True:
print("Hello")
def no():
while True:
print("N0")
thread_one = threading.Thread(target=say)
thread_two = threading.Thread(target=no)
thread_one.start()
thread_two.start()
You can read more about it here: https://www.geeksforgeeks.org/multithreading-python-set-1/
2 years ago
mesquite2234 You need to use threading.
import time
from threading import Thread
def go1():
print('1')
time.sleep(2)
Something
def go2():
Something
x = Thread(target=go1)
y = Thread(target=go2)
x.start()
y.start()
`2 years ago
hope you liked the name this is for a game im making and i hope people like this!
in a month hopefully the full game will be out hope you like this!
Python
Hello im trying to learn pygame but when i try to import it in any way in says Repl.it: Package operation failed.i looked and found a few posts about
Hello i have made a binary calcuatar idk why but i did so now i can get a A+ in :D
Python
HELLO i have made among us it is cool and if theres any bugs or glitchs or things i should add leave a command thanks!
Python
I just made a face idk why