You are not logged in. Please login at www.codechef.com to post your questions!

×

# [closed] HS08TEST (ATM) Python Runtime (NZEC) Error

 0 I am new to python, and trying my luck on some easy problems first. I have checked my source code for various inputs (problem code HS08TEST, link: http://www.codechef.com/problems/HS08TEST) but unable to find any problem but still it shows runtime error on submission. Please help guys. Here's my code: import sys withdraw, balance = map(float, sys.stdin.readline().split()) print ("%.2f" % balance) if int(withdraw)%5 != 0 or balance < (withdraw + 0.5) else ("%.2f" % (balance - withdraw - 0.5))  asked 17 Dec '13, 20:44 85●4●8●14 accept rate: 22% 3★kcahdog 10.0k●28●54●129

### The question has been closed for the following reason "The question is answered, right answer was accepted" by kcahdog 19 Dec '13, 18:58

 1 The sys.readline() reads the entire line so all characters on the line including the next line character "\n" are read which cannot be converted to float and causes NZEC. Just change it to sys.stdin.readline().strip().split()) to remove the "\n" and it works fine. here is the accepted version. answered 17 Dec '13, 21:39 3★kcahdog 10.0k●28●54●129 accept rate: 14%
 0 thanx buddy..!! :D answered 19 Dec '13, 09:47 85●4●8●14 accept rate: 22%

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• link:[text](http://url.com/ "title")
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×545
×529
×435
×231
×190
×41

question asked: 17 Dec '13, 20:44

question was seen: 2,701 times

last updated: 19 Dec '13, 18:58