Write two statements to read in values for my_city followed by my_state. Assign log_e - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Write two statements to read in values for my_city followed by my_state. Assign log_e (/thread-4818.html) |
Write two statements to read in values for my_city followed by my_state. Assign log_e - Eliteucantbeat - Sep-10-2017 You can't edit lines 1-4 and line 11. This is what I have: current_time = '2014-07-26 02:12:18:' my_city = '' my_state = '' log_entry = '' my_city = input("") my_state = input("") log_entry = (current_time + my_city + my_state) print(log_entry)The output I get is: Expected output is: Not sure how to get those spaces. I've tried using commas instead of + but then I just get this: Also triedmy_city = input("") my_state = input("") log_entry = print(current_time , my_city , my_state)but then I get this" help plz.
RE: Write two statements to read in values for my_city followed by my_state. Assign log_e - stranac - Sep-10-2017 One option is to manually add a space in between your data: log_entry = current_time + ' ' + my_city + ' ' + my_state A different (and better) solution would be to use string formatting: log_entry = f'{current_time} {my_city} {my_state}'
|