[Tutor] python coding problem

2016-09-26 Thread Richard Koeman
This is my first time using this so I hope it works.
I am trying to find out why this code doesnt work.
Its simple.  I want to find out which number is bigger.

I hope you can help and that I am using this python feature properly.
Thanks.
The function prints the first two print statements then nothing else
happens.

def maximum(n1, n2):
  print "the first number is" ,n1
  print "the second number is", n2
  if n1 > n2:
return
print n1 , "is the bigger number"
  elif n1 < n2:
return n2
print n2
  elif n1 == n2:
print "they are equal"
  else:
print "Sorry, No response found"
maximum(1,2)

-- 
This is a staff email account managed by Simcoe Muskoka Catholic District 
School Board.  This email and any files transmitted with it are 
confidential and intended solely for the use of the individual or entity to 
whom they are addressed. If you have received this email in error please 
notify the sender.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] please help me modify this code so that I can utilize raw_input

2016-10-04 Thread Richard Koeman
I would like to modify this code so that instead of me calling the function
with the list as shown [1,2,3,4], the user inputs the list with raw_input.

Thanks in advance


"""Define a function sum() and a function multiply() that sums and
multiplies (respectively) all the numbers in a list of numbers. For
example, sum([1, 2, 3, 4]) should return 10, and multiply([1, 2, 3, 4])
should return 24."""

def sum(mylist = [], *args):
  print mylist
  sum_of_number = 0
  for i in mylist:
sum_of_number += i
  print "The sum of the digits in your number is %s" %(sum_of_number)
def multiply(mylist = [], *args):
  product_of_number = 1
  for i in mylist:
product_of_number = product_of_number * i
  print "The product of the digits in your number is %s"
%(product_of_number)

sum([1,2,3,4])
multiply([1,2,3,4])

-- 
This is a staff email account managed by Simcoe Muskoka Catholic District 
School Board.  This email and any files transmitted with it are 
confidential and intended solely for the use of the individual or entity to 
whom they are addressed. If you have received this email in error please 
notify the sender.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor