# Tuple Assignment in Pyth

I was wondering if there is any way to assign 2 values (G and H) to say a list of ["egg", "chicken"] in Pyth. In python it would be something along the lines of

G, H = ["egg", "chicken"]


At the moment the shortest way I can think of would be something like

=N["egg""chicken")=G@N0=H@N1


which uses the lookup function to index the list and store each one individually. I tried doing something like

=(G H)["egg""chicken")


but when I look at the debug info Pyth debug info it doesn't seem to be what im after. Any help would be good thanks. This may include shortening the original solution or giving me an explanation on how to do the tuple assignment

• I'm not entirely sure this is on topic for this site. This is asking for help using a language, rather than for golfing tips. Granted that language is a golfing language, but I still think this is more appropriate for Stack Overflow Sep 9, 2021 at 22:37
• Are you looking for built-in or nice ways to do this, or short code that produces the assignment by any means?
– xnor
Sep 9, 2021 at 22:50
• both would be nice Sep 9, 2021 at 22:55
• @cairdcoinheringaahing I agree with you, but I think this question should be modified to better suit CGCC instead of being moved to SO, since the OP does seem to want help with shortening their code.
– user
Sep 10, 2021 at 0:01

This is exactly what the A builtin does: “Assign the first value of the list to G and the second to H. Return the input.”

A["egg""chicken")

• wow thanks exactly what i was looking for Sep 9, 2021 at 22:55