Can any robots help me with some python code?

Can any robots help me with some python code?
I have a function that asks for a person's name and checks the input isn't blank.
I want to store this input as a new variable that I can call up later, but I don't know what to do as any variable I make in the function is only local(?)
Can you help?
This is what my code looks like but I'm stuck.

Attached: Gyjj.jpg (764x301, 99.03K)

Learning python as your first language is like being born and then choosing to be permanently disabled for the rest of your life. Return the variable containing the input.

>blankLine

Attached: 1627652064629.gif (498x280, 1.05M)

God I'm glad I don't use Python or JavaScript.

Got bored of typing "\n"
So do I just need to put
Return name
After the last else?

Attached: Wettuii999.jpg (776x777, 43.8K)

You need to learn another language first, but yes.

Yeah I'm switching after this little project but I wanna finish this off.
Much appreciated

Is there an "Environment.NewLine" equivalent in Python to manage Windows/Unix-like differences?

Let's hear what languages 1337 coders like you prefer.

I agree with this user. It looks like you're trying to make a game, user, try something like Godot, Unreal Engine or Unity. It'll be a bit difficult at first but you'll become a much better programmer and game engines come with lots of utilities that'll save you time in making a game.

Return the name from the function.

C# and HLSL shit. GLSL if you count fucking around in shadertoy.

This is a bare basic text based choose your own adventure I wanted to do as a kind of babies first project.

Unironically C.
He should learn the basics first, considering he doesn't even know how to return a variable from a function.
From the looks of it, it looks like a text adventure game any ways, so there's no need to develop for a game engine.

Write machine code. If you're not writing directly to the chips, you're wasting power.

>He should learn the basics first
Hence this project and thread

Define your name var as a global var instead of local. You do this by defining it outside the function, like the top of the script.

Attached: 1621525925298.gif (500x436, 185.96K)

You could still do those in game engines but I understand. What're your next couple of projects?
Honestly that's how I learned the basics, just fucking around with Unity and reading microshit's documentation.

So something like name = str() outside of script
And then return the value given in the player name function to name?
(If I'm understanding that correctly, if not i apologise)

This is what I wrote, haven't tested, but I'm sure it works.

Attached: why not.png (832x271, 29.18K)

This should do it. Feel free to ask me stuff.

Attached: oops.png (792x172, 26.73K)

Not outside of the script.. Above the function in your pic. Post your whole code and I can provide a sample. I don't use Python myself but read some about the defining of global vars, which is what I think you need.

But basically something like this:

name = '';

def player_name():
name = input("blabla")
etc... etc..

Attached: 36174134_32x32.gif (200x200, 95.65K)

Oh it's already global. My mistake I misread.
I'm not sure if I'm using the function correctly.
Should I remove the whole checking if blank in the function and just make it the input?
I want to keep the check if blank but I guess I do that when I call it?

Attached: Gyhjj.jpg (738x1540, 363.86K)

You say it's global but it doesn't look like it.
Like after the defining of win, yn, yy, nn you should define either name or player_name too, whichever was giving the var is local error.

This robot got it. Clearly OP understands how to define variables outside the scope of a function... What are we helping with?

Attached: mpv_[SubsPlease] Shachiku-san wa Youjo Yuurei ni Iyasaretai - 01 (720p) [0F629D4B]_00:11:43_0003.jpg (1280x720, 192.12K)

Define a global var(bad habit) or make the function return a string
C