Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to i

Add a function to robot.py that will ask the child to provide a name for the robot.

Store this name so it can be used later.

Have the robot print Hello to the child in python?

What I have tried:

def robot_start():
    #step1
    """This is the entry function, do not change"""
    Toy_name = input("What do you want to name your robot? ") 
    print("HAL: Hello "+Toy_name)

def get_command_input():
    input("What do you want to name your bot? ") 
    print(input)
Posted
Updated 21-Nov-22 0:26am
Comments
Afzaal Ahmad Zeeshan 18-Nov-22 14:34pm    
You are asking for the input, but you are not storing the input value.

Your question is unclear.
Richard MacCutchan 19-Nov-22 4:54am    
Why are you asking the same question in two different places?

1 solution

Python
def robot_start():
    toy_name = get_toy_name()
    print("HAL: Hello " + toy_name)

def get_toy_name():
    return input("What do you want to name your robot? ")
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900