简体   繁体   English

如何在python中修复Mad Lib?

[英]How to fix a Mad Lib in python?

I have tried so many things to fix.我已经尝试了很多东西来修复。 This suppose to be easy but I can't get it to work.这应该很容易,但我无法让它工作。 I'm also using Repl.it as my IDE.我也使用 Repl.it 作为我的 IDE。 it stop working after I put my last variable in. Please help在我放入最后一个变量后它停止工作。请帮忙

    hobby = input("Please put your favorite thing to do: ")
person = input("Please put a person: ")
job = input("Please put a job: ")

print("I love to", + hobby)
print("I am", + person)
print("I want to be", + job)

You have two options, you can use a + with a space at the end of the prefixing string, or use a comma without the space:您有两个选择,您可以在前缀字符串末尾使用带空格的+ ,或使用不带空格的逗号:

hobby = input("Please put your favorite thing to do: ")
person = input("Please put a person: ")
job = input("Please put a job: ")

print("I love to " + hobby)
print("I am " + person)
print("I want to be " + job)

OR或者

hobby = input("Please put your favorite thing to do: ")
person = input("Please put a person: ")
job = input("Please put a job: ")

print("I love to", hobby)
print("I am", person)
print("I want to be", job)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM