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
        Strings
      • 7
        Lists
      • 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
        dict
      • 16
        Functions
      • 17
        Functions 2
      • 18
        Lambda and higher-order functions
      • 19
        Files

  • Students and apples 1

    There are s students in the class and they have a apples. They would like to split the apples among each other as equally as possible. So, they divide the apples among each other and gift the rest to their teacher. We would like to know how many apples are there going to be for each student and how many their teacher would get.
    The first line of the input contains the number of students s. The second line contains the number of apples a. Print the number of apples per student and the number of apples the teacher would get after division in the output.
    Input
    Output
    7 30
    4 2
    Explanation: There are 7 students and 30 apples. In case of equal division, students would get the following amount of apples: 4 4 4 4 4 4 4 and would leave the remaining 2 apples to their teacher.
     
    To check your solution you need to sign in
    Sign in to continue