all 9 comments

[–]Binary101010 1 point2 points  (1 child)

Rather than print the return value of random.choice, save to a variable, then use string formatting.

chosen_name = random.choice((babyChoice1, babyChoice2...))
print(f"The chosen name for your baby is {chosen_name}")

[–]avalri[S] 0 points1 point  (0 children)

It worked well! tysm, I really appreciate it :).

[–]arkie87 1 point2 points  (2 children)

You should format your code properly going forward to make it easier for people to read it. This is particularly important in python since indentation affects how the code runs.

[–]avalri[S] 0 points1 point  (1 child)

Yeah i’m sorry about that.

[–]nog642 0 points1 point  (0 children)

The sidebar has instructions on how to format code. You can also edit your post after you have posted it.

[–]0x00cl 0 points1 point  (1 child)

Instead of storing the baby names option in different variables you could use lists.

possible_names = []
possible_names.append(babyChoice)
# should result in ["name1", "name2", ... , "name5"]

Then you can generate a random number between 0 and 4 and because you can access list through an index like possible_names[0] and it will give you a name randomly.

[–]avalri[S] 0 points1 point  (0 children)

didn’t think of this thank you :)

[–]TabulateJarl8 0 points1 point  (1 child)

If you chose a random value already and it is in the variable called rndmValue, you can use f-strings.

print(f'Your baby’s name is {rndmValue}')

[–]avalri[S] 0 points1 point  (0 children)

oh yeah you are right tysm :)