%d,%s

% D numeric placeholder.
% S placeholder string.
 
 
"Hello, %s"%"zhang3" => "Hello, zhang3"
"%d"3 => "33"
"%s:%d"%("ab",3) => "ab:3"
 
m = input ( "Please enter the month")
sum=2
if m % 2 == 0:
    for i in range(0,m-1,2):
       sum = sum + 2 * i
if m % 2 == 1:
    for i in range(1,m-1,2):
       sum = sum + 2 * i
print ( "The total number of the month rabbit is:% d"% sum)
 

Guess you like

Origin www.cnblogs.com/myshuzhimei/p/11756103.html