# Read a value from a user and store the value in first_name
first_name = input('Eric')
whole_number = input('12')
plural_noun = input('cars')
generic_location = input('Chipotle')
# TODO: Type your code to read three more values here.
# Output a short story using the four input values. Do not modify the code below.
print(first_name, 'buys', whole_number, 'different types of', plural_noun, 'at', generic_location)
这就是我所拥有的,我不确定如何修复它以使其产生正确的输出。
我尝试更改输入或让它们读取不同的变量,我只是很新并且不确定我哪里出错了。
输入会自动存储在它所调用的变量中,例如“first_name”,您可以在任何时候使用它时读取它。
#Read a value from a user and store the value in first_name
first_name = input('Enter a name: ')
whole_number = input('Enter an integer: ')
plural_noun = input('Enter a noun in its plural form: ')
generic_location = input('Enter a location: ')
# Output a short story using the four input values.
print(first_name, 'buys', whole_number, 'different types of', plural_noun, 'at', generic_location)
您也可以执行最后一部分,例如:
print({} 'buys' {} 'different types of' {}, 'at' {}.format(first_name, whole_number, plural_noun, generic_location))
如果您希望句子使用单词“Eric”、“12”、“cars”和“Chipotle”,您可以将它们定义为普通变量,而不是输入。
first_name = 'Eric'
whole_number = '12'
plural_noun = 'cars'
generic_location = 'Chipotle'