python第二大奇数_python如何选择最大奇数_others_酷徒编程知识库

我試圖在python中製作一個簡單的程序,計算出值x,y,z的最大奇數,如何讓用戶選擇x,y和z的值?

我現在所擁有的,# This program exmamines variables x, y, and z

# and prints the largest odd number among them

if x%2 !== 0 and x > y and y > z:

print 'x is the largest odd among x, y, and z'

elif y%2 !== 0 and y > z and z > x:

print 'y is the largest odd among x, y, and z'

elif z%2 !== 0 and z > y and y > x:

print 'z is the largest odd among x, y, and z'

elif x%2 == 0 or y%2 == 0 or z%2 == 0:

print 'even'

# This program exmamines variables x, y, and z

# and prints the largest odd number among them

if x%2 !== 0:

if y%2 !== 0:

if z%2 !== 0:

if x > y and x > z: #x is the biggest odd

elif y > z and y > x: #y is the biggest odd

elif z > x and z > y: #z is the biggest odd

else: #z is even

if x > y: #x is the biggest odd

else: #y is the biggest odd

else: #y is even

if z%2 != 0: #z is odd

if x > z: #x is the biggest odd

else: #z is the biggest odd

else: #y,z are even and x is the biggest odd

else: #x is even

if y%2 != 0 and z%2 != 0; #y,z is odd

if y > z: #y is the biggest odd

else: #z is the biggest odd

else: #x and y is even

if z%2 != 0: #z is the biggest odd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值