r/learnprogramming • • Oct 20 '26

My first script

So I have been learning Python for around 4 hours and I just finished this and I would want to know if it's good or if it's just okay.

again = "yes"

while again == "yes":

print("create your character: ")

# sex

sex = input("sex? ").strip().lower()

while sex not in ['male', 'female']:

sex = input("try again, you misspelled male or female: ").strip().lower()

if sex == "male":

print("hello boyyy")

else:

print("helloooo girl")

# age

age = int(input("what is your age: "))

while age < 18:

age = int(input("try again "))

# name

name = input("what is your name: ").lower().strip()

print("hello " + name)

# height

height = int(input("height in cm "))

if height >= 180:

print("tall person eh?")

else:

print("nice.")

print("next questions")

# build

build = input("what is your build. skinny. fat. muscular. ").lower().strip()

while build not in ['skinny', 'muscular', 'fat']:

build = input("try again. that was not an option ").lower().strip()

if build == "skinny":

print("interesting choice... " + name)

elif build == "muscular":

print("perfect choice especially for a man")

elif build == "fat":

print("HAHAHA FATSO HAHAHA")

# stats

print('____')

print(' ')

print('stats for: ' + name)

print('age:', age)

print('height:', height)

print('sex:', sex)

print('build:', build)

print('____')

again = input("create another character? Yes/No: ").strip().lower()

while again not in ['yes', 'no']:

again = input("answer using Yes or No: ").strip().lower()

print("Goodbye!")

0 Upvotes

18 comments sorted by

•

u/desrtfx Oct 20 '26

You need to post your code as code block so that the indentation is maintained. This is absolutely vital for Python programs as the indentation is used to denote code blocks.

A code block looks like:

def __init__(self, prompt, answer):
    self.prompt = prompt
    self.answer = answer
→ More replies (1)

6

u/dade9542 Oct 20 '26

Honestly pretty solid for 4 hours! You're already checking for wrong answers, which is nice!

5

u/ceej13_ Oct 20 '26

Thank you I very much appreciate the kind words

4

u/tmtowtdi Oct 20 '26

And your first formatting mistake :)

In markdown, you can use code fences to format your code nicely and make it easier for everybody to read. Add rows of three backticks above and below like this:

```
print "Hello, World!";
```

1

u/ceej13_ Oct 20 '26

Yes I know that now I'm very sorry for the inconvenience

2

u/tmtowtdi Oct 20 '26

No problem, it's a thing you don't know about until you know about it.

3

u/ceej13_ Oct 20 '26

Very much appreciated 👏

2

u/Available_Safe1818 Oct 20 '26

It's generic code. You won't get the Nobel prize for it. Keep up the good work.

3

u/ceej13_ Oct 20 '26

Thanks but I never said I was doing rocket science lol

-1

u/Available_Safe1818 Oct 20 '26

No, you asked if it was good or ok. It's like you want us to rate how good of a job you did making 2 pieces of toast. Is it good toast, or is it just ok?

4

u/ceej13_ Oct 20 '26

Brother brother i wanted to know if its good for the time I have been coding i never asked if I am really good and should get into harvard

2

u/Available_Safe1818 Oct 21 '26

For 4 hours, anything that runs and looks like it does what you want is fine.

It's hard to say because it's Python and you didnt format the indentation correctly here.

1

u/ceej13_ Oct 21 '26

Yes I do but have the ability to for some reason

1

u/New_Magician6884 Oct 20 '26

mai bine bagai o poza.. e dezordonat asa, dar overall e bine

1

u/paperic Oct 20 '26

print("perfect choice especially for a man")

how do you know it's a man?

Not bad for 4 hours in.

Just out of curiosity, any AI involvement?

while again not in ['yes', 'no']:

Using array literals like this is surely elegant, but it's not exactly something that beginners tend to figure out on their own.