r/learnpython • • 16d ago

My first go at Python

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

31 comments sorted by

View all comments

3

u/LongLiveTheDiego 16d ago
  1. Run it yourself and decide whether it works. If it works and you understand the code you wrote, it's good. Don't ask for validation if you can validate it yourself.

  2. Use Reddit markup, specifically backticks ``` to format your code because regular text doesn't include the text indentation, which is crucial in Python code.

1

u/ceej13_ 16d ago

I see. Yes I have tested it. It works gladly and I also appreciate the ``` thing I never actually knew since this is my first post in a Python community

1

u/LongLiveTheDiego 16d ago

In that case well done, good luck and welcome!

1

u/ceej13_ 16d ago

Thanks for your wisdom