Ask the user for two positive numbers and add them together. If the answer is 50 or more then display the answer in a user friendly format. If the answer is below 50, ask the user to continue to select more numbers until the answer is 50 or above.
            Asked
            
        
        
            Active
            
        
            Viewed 34 times
        
    -2
            
            
        - 
                    1sounds like a homework :) – akash karothiya Oct 05 '17 at 10:38
- 
                    1Welcome to SO, you should go check out [how to build an MCVE](https://stackoverflow.com/help/mcve) because we wont be coding for you – Quentin Laillé Oct 05 '17 at 10:40
- 
                    1Have you tried anything yet? Post some code. Which part are you having trouble with? – bgfvdu3w Oct 05 '17 at 10:40
- 
                    all of it don't know what to do im the dumb kid – Edward.Cockell Oct 05 '17 at 10:41
- 
                    See [How do I ask a good question?](https://stackoverflow.com/questions/how-to-ask) – khelwood Oct 05 '17 at 10:41
- 
                    Possible duplicate of [Asking the user for input until they give a valid response](https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response) – Uvar Oct 05 '17 at 10:57
2 Answers
0
            
            
            sum = 0
    while sum <=50: 
        val1 = int(raw_input("Enter the first number: "))
        val2 = int(raw_input("Enter the second number:"))
        sum = val1+val2
        if sum >= 50:
            print "The sum is: "+sum
Use the above code. Hope it works. But this is an infinite loop, until the sum becomes 50.
 
    
    
        Vikram Sharma
        
- 199
- 2
- 2
- 13
0
            
            
        please try this
 sum=0;
 while sum <= 50:
  num1=input("enter first value ");
  num1=float(num1);
  num2=input("enter second value ");
  num2=float(num2);
  sum=num1+num2;
  print("sum of ",num1," and ",num2," is ",sum);
 
    
    
        immanuelRocha
        
- 16
- 2
