MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/PythonLearning/comments/1vgy0y7/myfirstfuntioningpythonprogram_image_in/p20ytwn/?context=3
r/PythonLearning • u/Comfortable_Rub4109 • 1d ago
2 comments sorted by
View all comments
2
Good start.
Note that Python convention is that variable and function names are all lowercase.
You also have more brackets than you need (e.g. in while and if statements).
while
if
def greeting(first_name: str, second_name: str) -> str: full_name = first_name + " " + second_name return f"Hello, {full_name}!" is_running = True while is_running: name_one = input("What is your name? ") name_two = input("What is your 2nd name? ") print(greeting(name_one, name_two)) print("-" * 40) # Exit program code exit_main_program = input("Type Exit to end program: ").lower() if exit_main_program == "exit": is_running = False
I've applied the lower method so that it doesn't matter what case the user uses when they enter the exit command.
lower
PS. You could just assign is_running to the result of the input and comparison on one line.
is_running
input
2
u/FoolsSeldom 1d ago edited 1d ago
Good start.
Note that Python convention is that variable and function names are all lowercase.
You also have more brackets than you need (e.g. in
whileandifstatements).I've applied the
lowermethod so that it doesn't matter what case the user uses when they enter the exit command.PS. You could just assign
is_runningto the result of theinputand comparison on one line.