Python, before seeking entry n and random number;

u = 0 # define a first variable
n = int (input ( 'Enter an integer:')) # enter a number, by converting to integer int class (Print default type of input string type)
for I in Range (. 1 , n + 1): # for loop cycle times n + 1

  u + = i # u + per loop variable i

print (u) # print variable u

Guess you like

Origin www.cnblogs.com/loganSxb/p/10941840.html