Write two statements to read in values for my_city followed by my_state. Do not provide a prompt. Assign log_entry with current_time, my_city, and my_state. Values should be separated by a space. Sample output for given program if my_city is Houston and my_state is Texas: 2014-07-26 02:12:18: Houston Texas Note: Do not write a prompt for the input values. 1 current_time = '2014-07-26 02:12:18:' 2 my_city = "' 3 my_state = "" 4 log_entry - "' 1 test passed 6 print(log_entry) All tests passed Run Run

Respuesta :

Answer:

Here is the program:

current_time = '2014-07-26 02:12:18:'  

my_city = ''

my_state = ''

log_entry = ''

 

my_city = input("")   #reads in value for my_city

my_state = input("")  #reads in value for my_state

log_entry = current_time + ' ' + my_city + ' ' + my_state   #concatenates current_time, my_city and my_state values with ' ' empty space between them

 

print(log_entry)

Explanation:

You can also replace

log_entry = current_time + ' ' + my_city + ' ' + my_state  

with

log_entry = f'{current_time} {my_city} {my_state}'

it uses f-strings to format the strings

If you want to hard code the values for my_city and my_state then you can replace the above

my_city = input("")

my_state = input("")

with

my_city = "Houston"

my_state = "Texas"

but if you want to read these values at the console from user then use the input() method.

The screenshot of the program along with the output is attached.

Ver imagen mahamnasir

In this exercise we have to use the knowledge of the python language to write the code, so we have to:

The code is in the attached photo.

So to make it easier the code can be found at:

current_time = '2014-07-26 02:12:18:'

my_city = ''

my_state = ''

log_entry = ''

my_city = input("")   #reads in value for my_city

my_state = input("")  #reads in value for my_state

log_entry = current_time + ' ' + my_city + ' ' + my_state   #concatenates current_time, my_city and my_state values with ' ' empty space between themlog_entry = current_time + ' ' + my_city + ' ' + my_state

log_entry = f'{current_time} {my_city} {my_state}'

my_city = input("")

my_state = input("")

my_city = "Houston"

my_state = "Texas"

See more about python at brainly.com/question/26104476

Ver imagen lhmarianateixeira