HW in PYTHON
# find the sum of all of the integers from 0 to 10 # (inclusive).Use the variable total to hold # the total sum # Use the variable num to hold the current number # in the sequence
total = 0 # initialize the total variable
for num in range(0,11): total = total + num print(num)
print (total)
--------------
for i in range (5): print(i)
------------------
#Ask the user to enter a number. #Store the result in variable num.
num = int(input('Enter a number.'))
if num % 2 == 0: print('Even') else: print('Odd')
------------------
#Asks the user how many petals their daisy has # and stores the result in a variable called petals. #Use a for loop to print out the following output, #based on the number of petals entered: petals = input('How many petals?')
for i in range(0, int(petals)): if int(i) % 2 == 1: print('S/He loves me not.') else: print('S/He loves me.') ----------- for i in range(0, 4): for j in range(2, 4): print ('i: ' + str(i) + ' and j: ' + str(j))
https://blackboard.uiwtx.edu/bbcswebdav/pid-4362757-dt-content-ri...
1 of 1 2/11/18, 6:37 PM