Skip to content

Commit

Permalink
add problem 20200531
Browse files Browse the repository at this point in the history
  • Loading branch information
liukai234 committed Jun 1, 2020
1 parent 93b0db2 commit 2da66dd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
15 changes: 15 additions & 0 deletions 圆圆的py/randcreat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import random

list=""

for i in range(4):
j=random.randrange(0,4)

if j == 1:
list = list + str(random.randrange(0,10))
elif j == 2:
list = list + chr(random.randrange(65,91))
else:
list = list + chr(random.randrange(97,123))

print(list)
16 changes: 16 additions & 0 deletions 圆圆的py/root.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import math
a = float(input("a = "))
b = float(input("b = "))
c = float(input("c = "))
if a != 0:
delta = math.pow(b, 2)-4*a*c
if delta < 0:
print("无解")
elif delta == 0:
s = -b/(2*a)
print("一个解x =",s)
else :
root = math.sqrt(delta)
x1 = (-b+root)/(2*a)
x2 = (-b-root)/(2*a)
print("x1=",x1,"\t","x2=",x2)

0 comments on commit 2da66dd

Please sign in to comment.