我试图多次打印一行,但无法使它们缩进新行,请支持。
code:
Input_Name = input('please enter your Name')
Input_age = int(input('please enter your Age'))
Input_a_Number = int(input('please enter another number'))
Difference_Number = 100 - Input_age
print(( "Dear",Input_Name,"you will get 100 years old after" ,Difference_Number, "years",
"\r\n")*Input_a_Number)
结果:
please enter your Names
please enter your Age2
please enter another number3
('Dear', 's', 'you will get 100 years old after', 98, 'years', '\r\n', 'Dear', 's', 'you will get 100 years old after', 98, 'years', '\r\n', 'Dear', 's', 'you will get 100 years old after', 98, 'years', '\r\n')
尝试运行它。
Input_Name = input('please enter your Name')
Input_age = int(input('please enter your Age'))
Input_a_Number = int(input('please enter another number'))
Difference_Number = 100 - Input_age
print(("Dear " + str(Input_Name) + " you will get 100 years old after " +
str(Difference_Number) + " years" + "\n")*Input_a_Number)
或根据需要使用逗号
Input_Name = input('please enter your Name')
Input_age = int(input('please enter your Age'))
Input_a_Number = int(input('please enter another number'))
Difference_Number = 100 - Input_age
print(('("Dear", Input_Name, "you will get 100 years old after",
Difference_Number, "years", )' + '\n')*Input_a_Number)