Zu Hauptinhalten überspringen

Cookie Einstellungen

Wir verwenden Cookies, um die grundlegenden Funktionalitäten der Website zu gewährleisten und Ihr Online-Erlebnis zu verbessern. Sie können jederzeit die Verwendung der Cookies konfigurieren und akzeptieren oder Ihre Zustimmungsoptionen ändern.

Notwendige

Präferenzen

Analysen und Statistiken

Marketing

Änderungen an „Django Preview.“

Avatar: Gabriel Washington Gabriel Washington

Titel (English)

  • +Django Preview.

Titel (Català)

Titel (Čeština)

Titel (Deutsch)

Titel (Castellano)

Titel (Euskara)

Titel (Suomi)

Titel (Français)

Titel (Italiano)

Titel (日本語)

Titel (Nederlands)

Titel (Polski)

Titel (Português)

Titel (Română)

Beschreibung (English)

  • +<p>Over the past week with my Django task, I find it necessary to go on with Python classes and functions review before exploring Django.</p><h4><strong>Prerequisite: Python Refresher (3-7 Days)</strong></h4><ol><li><p><strong>Functions</strong>:</p><ul><li><p>Practice: Write a function that calculates factorial or filters lists.</p></li><li><p>Resource: <a target="_blank" href="https://www.w3schools.com/python/python_functions.asp" rel="noreferrer">Python Functions (W3Schools)</a>.</p><ul><li><p><strong>Solution Factorial:</strong></p><p># A function that calculates factorials or filters lists.</p><p>def factorial(n):</p><p> if n &lt; 0:</p><p> return "Factorial is not defined for negative numbers."</p><p> elif n == 0 or n == 1:</p><p> return 1</p><p> else:</p><p> result = 1</p><p> for i in range(2, n + 1):</p><p> result *= i</p><p> return result</p><p># Example usage:</p><p>print(factorial(5)) # Output: 120</p><p>print(factorial(0)) # Output: 1</p><p>print(factorial(-3)) # Output: "Factorial is not defined for negative numbers."</p></li><li><p><strong><u>OUTPUT:</u></strong><br> return factorial(data)</p><p>NameError: name 'factorial' is not defined</p><p>&gt;&gt;&gt; %Run 'factorial(n).py'</p><p>120</p><p>1</p><p>Factorial is not defined for negative numbers.</p></li><li><p></p><p></p><p></p></li></ul></li></ul></li><li><p><strong>OOP</strong>:</p><ul><li><p>Build a <code>Student</code> class with attributes (<code>name</code>, <code>grade</code>) and methods (<code>update_grade</code>).</p></li><li><p>Watch: </p><div class="editor-content-videoEmbed" data-video-embed="https://youtu.be/ZDa-Z5JzLYM"><div><iframe src="https://www.youtube-nocookie.com/embed/ZDa-Z5JzLYM" title="" frameborder="0" allowfullscreen="true"></iframe></div></div></li></ul></li></ol><p>I have installed Django on my local machine and am beginning to explore the MVC implementation.</p>

Beschreibung (Català)

Beschreibung (Čeština)

Beschreibung (Deutsch)

Beschreibung (Castellano)

Beschreibung (Euskara)

Beschreibung (Suomi)

Beschreibung (Français)

Beschreibung (Italiano)

Beschreibung (日本語)

Beschreibung (Nederlands)

Beschreibung (Polski)

Beschreibung (Português)

Beschreibung (Română)

Startdatum

  • +2025-04-16

Enddatum

  • +2025-04-23

Fortschritt

  • +7.0

Bestätigen

Bitte melden Sie sich an

Das Passwort ist zu kurz.

Teilen