Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7909693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:33:11+00:00 2026-06-03T12:33:11+00:00

I tried to run the following code, which is inside of a Bash-script. NUMBER=600

  • 0

I tried to run the following code, which is inside of a Bash-script.

NUMBER=600
LOSS_RATE=0,3
TOT_PKT=100

test=$(python -c "from math import ceil; print ceil($NUMBER * 500.0)")
test2=$(python -c "from math import ceil; print ceil($NUMBER * $LOSS_RATE)")
echo $test
echo $test2

I get the following printed out:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: ceil() takes exactly one argument (2 given)
300000.0

The first Python-command is executed, but the second causes the given TypeError. How do I do to resolve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:33:12+00:00Added an answer on June 3, 2026 at 12:33 pm

    Python uses . as the decimal point since , is the argument separator. So if you use LOSS_RATE=0.3 everything should work fine:

    > NUMBER=600
    > LOSS_RATE=0.3
    > python -c "from math import ceil; print ceil($NUMBER * $LOSS_RATE)"
    180.0
    

    The problem lies in the shell script. echo instead of python -c the code and you’ll see it:

    > echo "from math import ceil; print ceil($NUMBER * $LOSS_RATE)"
    from math import ceil; print ceil(600 * )
    

    You never define LOSS_RATE. However, this results in a SyntaxError. Since you get a different error it sounds like LOSS_RATE is set to something containing a comma.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following CPython code which I now try to run in IronPython:
The following code utilizes CreateProcess to run commands with environmental variables. Here, it tries
I tried to run the following command and it says there is nothing to
I received the following error when I tried to run a C# WinForms application
Following the README instructions of the jboss-as-kitchensink example , I have tried to run
Following the instructions at the Observer User Guide , I tried to run the
i run nexus-2.0.2 on linux, following nexus referrence, i tried to start up nexus,
I tried to run this code: #define ROW_CNT 8; #define COLUMN_CNT 24; #define FIRST_COLUMN
I can't seem to run the following code in Eclipse. I do have a
When I run the following code, images are saved and I can see them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.