File tree 4 files changed +12
-19
lines changed 4 files changed +12
-19
lines changed Original file line number Diff line number Diff line change
1
+
2
+ week-4 /inflect /__pycache__ /inflect.cpython-310.pyc
3
+ week-5 /bank /__pycache__ /bank.cpython-310-pytest-7.1.3.pyc
4
+ week-5 /bank /__pycache__ /bank.cpython-310.pyc
5
+ week-5 /twtter /__pycache__ /test_twttr.cpython-310-pytest-7.1.3.pyc
6
+ week-5 /twtter /__pycache__ /twttr.cpython-310.pyc
7
+ week-5 /bank /__pycache__ /test_bank.cpython-310-pytest-7.1.3.pyc
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 13
13
if len (sys .argv ) == 2 :
14
14
15
15
# covert command line argument to float Number
16
- try :
16
+ try :
17
17
user_input = float (sys .argv [1 ])
18
18
except ValueError :
19
19
print ("Command-line argument is not number" )
20
- # if yser input in not Number
20
+ # if yser input in not Number
21
21
sys .exit (1 )
22
22
else :
23
23
# if user not cooperate and Enter a Number
27
27
try :
28
28
# calling api
29
29
answer = requests .get ("https://api.coindesk.com/v1/bpi/currentprice.json" ).json ()
30
- price = float (answer [' bpi' ][ ' USD' ][ ' rate_float' ])
30
+ price = float (answer [" bpi" ][ " USD" ][ " rate_float" ])
31
31
price = price * user_input
32
32
print (f"${ price :,.4f} " )
33
33
sys .exit (0 )
34
34
35
- except (requests .RequestException ,ValueError ):
35
+ except (requests .RequestException , ValueError ):
36
36
print ("Error" )
37
37
sys .exit (1 )
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def test_names():
19
19
20
20
def test_numbers ():
21
21
assert shorten ("123987" ) == '123987'
22
- assert shorten ("123456879" ) == '123 '
22
+ assert shorten ("123456879" ) == '123456879 '
23
23
24
24
25
25
def test_uppercase ():
You can’t perform that action at this time.
0 commit comments