fb pixel

Introduction to Python

  • Profound Academy

    • Status
      • 1
        Input and Output
      • 2
        Variables and Integer Arithmetic
      • 3
        Conditional Operators
      • 4
        Advanced Conditions - Nesting
      • 5
        Types and Variables
      • 6
      • 7
      • 8
        For Loops
      • 9
        While Loops
      • 10
        continue, break, while...else
      • 11
        String and List methods
      • 12
        Nested Loops
      • 13
        List Comprehension
      • 14
        Tuples and Sets
      • 15
      • 16
      • 17
        Functions 2
      • 18
        Lambda and higher-order functions
      • 19

  • Battlefield

    You are playing a strategy game . There is a battle happening right now between your soldiers and your biggest opponent. Both of you are losing forces and you want to be sure you’ll win if everything continues at this rate, and plan the strategy accordingly.
    You see that you lose approximately x soldiers in a minute, while your opponent loses y soldiers in the same time frame. You initially have soldiers, while your opponent has soldiers on the battlefield. The battle continues until any of the parties lose all their soldiers.
    The first line of the input contains the number of your initial soldiers , followed by the rate (x) at which you lose soldiers. The third line contains the initial number of soldiers of the opponent , followed by the rate at which they lose soldiers y.
    Your program should print You will win if you are expected to win if things continue in the same manner, and it should print There is a danger of losing otherwise.
    100 5 200 30
    You will win
    To check your solution you need to sign in
    Sign in to continue