Thursday, December 31, 2015

Day 4


these two programs give me different outputs, why? 


total = 0
for num in range (101):
   total = total + num
   print (total)


total = 0
for num in range (101):
   total = total + num
print (total)


for loop

this is not like a while loop



Range (start, end, step)


Standard library.
Math
Random, etc

import Statement

import module

import random

import sys

use pip to import third party modules

No comments:

Post a Comment