python programming help?

2009-02-23 11:29 pm
i tryed to make sometime that inputs a number then tells me which one is the largest and smallest:
A= raw_input("Enter your list of numbers, seperated by commas-> ")
B= max(A)
C= min(A)
print "The largest number is ->", B
print "The smallest number is ->", C


but how come the largest value can't be over 9 and the smallest value comes out to be ","?

回答 (1)

2009-02-24 12:33 am
The problem is that A is a string, not a list of numbers. To get it to be a list of numbers use the input() function instead of raw_input().


收錄日期: 2021-05-01 01:10:01
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090223152938AAbzROL

檢視 Wayback Machine 備份