2
對不起,如果問題關閉,但這是一些簡單的代碼。加入變量和字符串以獲得變量
quiz_description = 'A quiz to test your knowledge'
quiz_type = 'This quiz is about social studies'
quiz_length = 'This test is five minutes long'
while 0 == 0:
user_input = input('What do you want to know about the quiz? (length|type|description)\n')
print('quiz_' + user_input)
此代碼將導致
quiz_lenght
但我想加盟quiz_
和user_input
,這是length
,並導致quiz_lenght
和顯示的內容設置該字符串,這是'This test is five minutes long'
。
有沒有辦法達到這個目的?