python怎么在同一行输入_已解决:python;在同一行依次输入三个值a,b,c,用空格分开,输出;b*b-4*a*c的值...

问题:python 在同一行依次输入三个值a,b,c,用空格分开,输出 b*b-4*a*c的值

满意答案:

#拒绝回答一系列代码细节,自行百度学习对应函数

import re

import math

print("Input four numbers seperated by scape, enter `#` for ending input")

myinputs = []

t = input("four numbers:")

while t != "#":

tmp = re.split("\s+",t)

tmp = tuple([float(i) for i in tmp])

if len(tmp) != 4:

print("Wrong input! input another one")

else:

print("Other pair of points or `#` for ending?")

myinputs.append(tmp)

t = input("four numbers:")

print("Input pairs of points:")

for i in myinputs:

print(i)

print("The distances:")

for i in myinputs:

d = math.sqrt((i[0]-i[2])**2 + (i[1]-i[3])**2)

print("%.2f" % d)

'''

例子如下

Input four numbers seperated by scape, enter `#` for ending input

four numbers:1 1 2 2

Other pair of points or `#` for ending?

four numbers:2 3 4 5

Other pair of points or `#` for ending?

four numbers:#

Input pairs of points:

(1.0, 1.0, 2.0, 2.0)

(2.0, 3.0, 4.0, 5.0)

The distances:

1.41

2.83

'''

其他回答:

这种函数很简单的吧其他回答:

a=input('请输入')

b=input('请输入')

c=input('请输入')

print(b*b-4*a*c)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值