1. 程式人生 > >the Way of Python Day 2

the Way of Python Day 2

sim similar sha maximum per AD lar pick may

  today,i got lots of knowledge of python ,like how to get the maximum value of three numbers.

  similarly i already was able to write a program of how to get the minium number among many numbers.

  here is the minium value program:

num_one=input("enter number one :")
num_two=input("enter number two :")


num_three =input("enter number three :")

min_num = 1

if num_one>num_two :
min_num= num_one
else :
min_num= num_two
if min_num >num_three:
min_num = num_three
print("the minium number is",min_num)

  here is the maximum value program:

num1=input("enter Num1:")

num2=input("enter Num2:")

num3=input("enter Num3:")

max_num=0

if num1>num2:
max_num=num1
else :
max_num=num2
if max_num < num3:
max_num = num3
print("the max num is ",max_num)

  i would share my experience about these two programs,maybe you could get something from it.

at first , use input to get three numbers.

then ,choose two numbers of them to compare size,and get the larger number.

in the end ,pick the last number to compare with the larger number,so get the maximum number.

the Way of Python Day 2