Lesson 5: Counting numbers with for loop

posted Nov 3, 2017, 7:57 AM by Attila Lengyel   [ updated Nov 9, 2017, 7:50 AM ]
print("1")
print("2")
print("3")

for x in range(1,101):
  print(x)

total = 0

ub = int(input("Give me ub:"))

for x in range(0,ub+1):
  total = total + x

print ("The total is", total)

start = 1

for x in range(0, ub + 1):
  print(start)
  start += 2
  if start > ub:
    break

Comments