首页 > 编程语言 > 详细

the Way of Python Day 2

时间:2018-05-16 19:28:13      阅读:203      评论:0      收藏:0      [点我收藏+]

  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

原文:https://www.cnblogs.com/margin1314/p/9047518.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!