Python 3
Write a function sortedNumbers (num1, num2, num3), in ascending order number three,
Write a test program to prompt the user to enter three integers, then calls the function in ascending order according to number three,
CodePudding user response:
Def sortedNumbers (num1, num2 num3) :
List=[]
List. Append (num1)
List. Append (num2)
List. Append (num3)
List. The sort ()
For I in list:
Print (I)
Num1=int (input (" both please input 1 st number: "))
Num2=int (input (" both please input 2 nd number: "))
Num3=int (input (" both please input 3 rd number: "))
SortedNumbers (num1, num2, num3)
CodePudding user response:
The
reference 1/f, 5250 response: def sortedNumbers (num1, num2, num3) : List=[] List. Append (num1) List. Append (num2) List. Append (num3) List. The sort () For I in list: Print (I) Num1=int (input (" both please input 1 st number: ")) Num2=int (input (" both please input 2 nd number: ")) Num3=int (input (" both please input 3 rd number: ")) SortedNumbers (num1, num2, num3) Big bosses, how let him show the final computation results output: "please enter the number three (separated by commas) :" in this form? CodePudding user response:
#! The/usr/bin/python # coding=utf-8 List=[]; For I in range (3) : List. Append (eval (raw_input (" please enter the first % d integer: "% (I + 1)))) List. The sort () Print (list); CodePudding user response:
refer to the second floor kusanagiyoli response: Quote: reference 1/f, 5250 response: def sortedNumbers (num1, num2, num3) : List=[] List. Append (num1) List. Append (num2) List. Append (num3) List. The sort () For I in list: Print (I) Num1=int (input (" both please input 1 st number: ")) Num2=int (input (" both please input 2 nd number: ")) Num3=int (input (" both please input 3 rd number: ")) SortedNumbers (num1, num2, num3) Big bosses, how let him show the final computation results output: "please enter the number three (separated by commas) :" in this form? What you mean, one-time input number three? Num1, num2, num3=input (" please enter the number three: "). The split (', ') CodePudding user response:
5250 reference 4 floor response: Quote: refer to the second floor kusanagiyoli response: The Quote: reference 1/f, 5250 response: def sortedNumbers (num1, num2, num3) : List=[] List. Append (num1) List. Append (num2) List. Append (num3) List. The sort () For I in list: Print (I) Num1=int (input (" both please input 1 st number: ")) Num2=int (input (" both please input 2 nd number: ")) Num3=int (input (" both please input 3 rd number: ")) SortedNumbers (num1, num2, num3) Big bosses, how let him show the final computation results output: "please enter the number three (separated by commas) :" in this form? What you mean, one-time input number three? Num1, num2, num3=input (" please enter the number three: "). The split (', ') Yes, thank you bosses!