Programmation
670 documents à télécharger gratuitement
Cours, examens, TD, TP et exercices de programmation. Thèmes couverts : algorithmique, langage C, Java, Python, POO, structures de données.
This document outlines a series of exercises designed to teach the fundamentals of Python programming. It includes tasks such as drawing triangles, checking for palindromes, finding the maximum in a list, eliminating duplicates, and creating a simple calendar. These exercises are intended for beginners to enhance their programming skills in Python.
This document introduces a hands-on programming activity aimed at implementing a Python class named 'Voiture' that simulates a car's behavior. The class initializes with default attributes, including brand, color, driver, and speed. It provides methods to designate or change the driver, modify the speed through acceleration or deceleration, and display the car's properties. The exercise enforces logical constraints, like requiring a driver before allowing speed changes, to reinforce programming concepts. Examples demonstrate the class functionality and explore different use cases.
This document outlines an activity for creating a Python class named Voiture that simulates the behavior of a car. It describes default attributes, methods for modifying the driver and speed, and includes examples of class usage. The activity focuses on understanding object-oriented programming principles in Python.
This document provides a structured overview of Python classes, covering their definition, syntax, usage of attributes and methods, object instantiation, constructors and destructors, modular programming, inheritance (single and multiple), method overloading, and handling collections of objects. Key examples and coding demonstrations illustrate how to design classes, apply inheritance hierarchies, and manage complex object interactions efficiently in Python.
This document outlines the fundamentals of classes in Python, including their structure, attributes, methods, constructors, and destructors. It provides definitions, syntax, and examples to facilitate understanding and practical application in coding. The content is designed for students learning object-oriented programming principles.
This document provides an introduction to Python programming, covering basic concepts, control structures, functions, and sequences. It includes information on installation, data types, and variable assignments. The course also discusses Python's features and its application in various fields.
This document outlines a practical exercise in handling candidate records for a competition stored in a text file. It requires the definition of several functions to manage data entry and selection based on specific criteria. The tasks include filling data, creating filtered files, and implementing deletion criteria for candidates over a certain age.
This document covers the core Python sequence data types, including strings, lists, and tuples. It explains their characteristics, operations, and methods, such as slicing, concatenation, and specific usage scenarios like immutability for strings and tuples. Lists are showcased for their mutability, while tuples are highlighted for their immutability and efficient resource usage. Examples and code snippets provide students with practical implementations of these principles.
This document provides an introduction to sequences in Python, detailing the types of sequences, particularly strings, lists, and tuples. It highlights operations on strings, including common functions and methods. Practical examples illustrate how to manipulate strings through various functions.
This document outlines an exercise in which a script is created to manage a database of student information using a dictionary. It involves writing two functions: one for filling the dictionary with user-inputted data and another for consulting student details based on a given name. The final output formats the student's age and height in a clear text format.
This document introduces Python's associative arrays (dictionaries) and sets, along with their characteristics and operations. It explains dictionary basics, emphasizing key-value pairing, accessing and modifying data, iteration, and related methods. Sets, including mutable sets and immutable frozensets, are explored with focus on their unique elements, mathematical operations, and usage. Comprehensive examples demonstrate syntax, functionality, and distinctions between data structures.
This document provides an overview of dictionaries in Python, detailing their characteristics, syntax, and examples. It covers operations such as adding, removing, and accessing elements, as well as iterating through dictionaries. The key concepts around associative arrays are also discussed.
The document serves as an introductory guide to Python programming, covering its historical background, core characteristics, and use cases among major organizations. It provides an overview of Python's syntax, data types (including int, float, complex, bool, and str), and fundamental operations like arithmetic and logical expressions. The document also introduces installation methods, interactive/script modes, and input/output operations while emphasizing Python's simplicity, portability, and extensibility. It concludes with examples of practical usage and key rules for Python's syntax and...
This document outlines Activity 3.1 related to an introduction to Python programming. It poses a question about a concept mentioned in a video that is not included in the course PDF. Additionally, it requires writing a program to determine the length of a given string using the mentioned concept.
This document involves an exercise aimed at beginners in Python programming. It presents a list of numbers and requires the implementation of two functions: one to find the maximum value and another to categorize the numbers into even and odd. The exercise is designed to foster understanding of basic programming concepts and function definitions.
This document provides a comprehensive guide to Python functions, starting from their declaration and syntax, including `def`, docstrings, parameters, and return statements. It explains argument handling with default values, positional, and named arguments, and discusses scope through local and global variables. More advanced topics like function nesting, the use of the `global` keyword, and anonymous `lambda` functions are also covered in a concise yet systematic manner. Numerous examples illustrate these programming constructs clearly.
This document is a tutorial on Python functions, covering function declaration, calling functions, variable scopes, and the use of lambda functions. It includes examples and explanations of local and global variables, along with function nesting. The document aims to enhance understanding of function usage in Python programming.
This document provides an introduction to Object-Oriented Programming (OOP) concepts, including classes, objects, encapsulation, inheritance, polymorphism, and abstraction. It outlines the definition of classes, object creation, and the importance of these concepts in programming. The content is structured as a textbook chapter for educational purposes.
This document presents a programming exercise related to financial mathematics. It involves calculating the accumulated value of an investment made under compound interest. The exercise spans a 10-year period with annual deposits.
This document outlines an activity focused on calculating the potential roots of a quadratic equation. It provides a reminder of the quadratic formula and details on how to determine the number of real roots based on the discriminant. The document specifies the conditions for having two, one, or no real roots for the equation ax² + bx + c = 0.
This document provides an overview of control structures in Python, including conditional statements, iterative structures, and sequence interruptions. Conditional structures, such as the 'if' statement, are used to execute instructions based on specific conditions with an emphasis on indentation. Iterative structures, such as 'while' and 'for' loops, are detailed with various examples for handling ranges, collections, and specific conditions. It also explains sequence interruption using 'break' and 'continue' statements to fine-tune loop execution and control program flow.
This document covers control structures in Python, focusing on conditional statements and iterative structures. It includes detailed explanations and examples of 'if', 'while', and 'for' statements. Additionally, it discusses the use of 'break' and 'continue' statements to control loop execution.
This document describes how to calculate the ideal body mass (BMI) for adult males and females using a specific set of mathematical formulas based on height. It provides distinct formulas for males and females that incorporate height adjustments for optimal weight estimation. The task requires writing a Python program named BMI.py to automate these calculations for any provided height. The exercise emphasizes practical programming and the application of mathematical models.
This document introduces learners to basic Python operations using the interpreter. It includes exercises on arithmetic operations, variable assignment, and operator precedence. Students are asked to predict the outcomes of Python instructions and validate results manually. The focus is on understanding arithmetic priority and operator behavior in programming contexts.























