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

  • Concatenate two files

    There are two files with text in them. The first one has all the lines enumerated like in the example below:
    1. Individuals and Interactions Over Processes and Tools
    2. Working Software Over Comprehensive Documentation
    3. Customer Collaboration Over Contract Negotiation
    4. Responding to Change Over Following a Plan
    The second one just has lines one after another. You are asked to merge the second one into the first one by continuing the enumeration and appending the lines from the second file.
    The input contains two lines - the name of the first file and the name of the second one.
    The program should merge the files.
    Input
    doc.txt
    second.txt
    
    doc.txt
    1. Individuals and Interactions Over Processes and Tools
    2. Working Software Over Comprehensive Documentation
    3. Customer Collaboration Over Contract Negotiation
    4. Responding to Change Over Following a Plan
    
    second.txt
    Customer satisfaction through early and continuous software delivery
    Accommodate changing requirements throughout the development process
    Frequent delivery of working software
    Collaboration between the business stakeholders and developers throughout the project
    Support, trust, and motivate the people involved
    Enable face-to-face interactions
    Working software is the primary measure of progress
    Agile processes to support a consistent development pace
    Attention to technical detail and design enhances agility
    Simplicity
    Self-organizing teams encourage great architectures, requirements, and designs
    Regular reflections on how to become more effective
    
    Resulting doc.txt
    1. Individuals and Interactions Over Processes and Tools
    2. Working Software Over Comprehensive Documentation
    3. Customer Collaboration Over Contract Negotiation
    4. Responding to Change Over Following a Plan
    5. Customer satisfaction through early and continuous software delivery
    6. Accommodate changing requirements throughout the development process
    7. Frequent delivery of working software
    8. Collaboration between the business stakeholders and developers throughout the project
    9. Support, trust, and motivate the people involved
    10. Enable face-to-face interactions
    11. Working software is the primary measure of progress
    12. Agile processes to support a consistent development pace
    13. Attention to technical detail and design enhances agility
    14. Simplicity
    15. Self-organizing teams encourage great architectures, requirements, and designs
    16. Regular reflections on how to become more effective
    
     
    To check your solution you need to sign in
    Sign in to continue