串联Zybooks Lab 2.1.2

发布于 2025-02-12 12:47:40 字数 588 浏览 3 评论 0原文

写两个语句以读取my_city的值,然后是my_state。不提供 迅速的。用current_time,my_city和my_state分配log_entry。值应分开 通过一个空间。如果my_city是休斯顿,而my_state是德克萨斯州的样本输出: 2014-07-26 02:12:18:德克萨斯州休斯顿 注意:不要为输入值编写提示。

current_time = '2014-07-26 02:12:18:'
my_city = ''
my_state = ''
log_entry =

''' Your solution goes here '''

print(log_entry)

我尝试了几种解决方案,它只是打印出日期和时间。自日期以来 时间给了时间,我认为将城市和州字符串串联,然后在日志下添加它们 输入但是它仍然只打印出日期。我不能进入实际的城市和州 因为有一个后端测试,Zybooks增加了另一个城市和州。这就是我 到目前为止尝试过。

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

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.

current_time = '2014-07-26 02:12:18:'
my_city = ''
my_state = ''
log_entry =

''' Your solution goes here '''

print(log_entry)

I've tried several solutions and it is only printing out the date and time. Since the date and
time is given, I figured to concatenate the city and state strings then add them under log
entry however it still only prints out the date. I can't enter the actual city and state
because there is a back end test where Zybooks add a different city and state. Here is what I
have tried so far.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

滥情稳全场 2025-02-19 12:47:40

实际上弄清楚了。

my_city = input("")
my_state = input("")
log_entry = (current_time + ' ' + my_city + ' ' + my_state)

Actually figured it out.

my_city = input("")
my_state = input("")
log_entry = (current_time + ' ' + my_city + ' ' + my_state)
记忆消瘦 2025-02-19 12:47:40
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)
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)
飘过的浮云 2025-02-19 12:47:40

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

my_city = input()

my_state = input()

log_entry =(current_time +''' + my_city +' +'' + my_state)

print(log_entry)print(log_entry)

此工作!

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

my_city = input()

my_state = input()

log_entry = (current_time + ' ' + my_city + ' ' + my_state)

print(log_entry)

This work for me!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文