Home > other >  The great spirit show python homework, all of you!
The great spirit show python homework, all of you!

Time:09-20

CodePudding user response:

 
A=input (" please enter a value:)
N=input (' please enter n value:)
A_list=[]
For I in range (int (n), 0, 1) :
A_list. Append (int I) (a *)

Result=a_list [0] - sum (a_list [1])
Print (f 'result={result}')

CodePudding user response:

 [color=# FFCan=(input (' a value of 1-9: the value of n: 1-80 ')) 
A, n=the an. The split (" ")
A, n=int (a), int (n)
Print (a, n)
S=int (STR) (a) * n)
For num in range (1, n) :
S=s - int (STR) (a) * num)
Print (s) C00] [/color]

CodePudding user response:

 a, b=input (" & gt;" ). The split () 
Print (sum ([int (a * I) if I==int * int the else - 1 (b) (a * I) for I in range (int (b), 0, 1))))

CodePudding user response:

A, n=input (). The split (" ")
N=int (n)
R=list (map (lambda n: a * n, [x for x in range (n, 0, 1)))) # with the map function to create an iterator, anonymous expression returns a single, iterator elements similar to [2222222222], with a list () converts an iterator to list
Sub=int # (r [0])
the first value as the results achievedFor I in r [1] :
Sub=sub - int (I) # cycle minus the value behind the
Print (sub)
  • Related