Results for “if”

Showing 1–10 of 15

  1. Article Python Fundamentals

    Python If/Else for Beginners

    Learn Python if, elif, and else with clear, space-themed examples and hands-on exercises. Perfect for beginners who want to chart the control flow of their programs.

  2. Article Mini projects

    Medical dispenser - Don’t trust the user

    …# Trust whatever time is given (or system time) if current_time is None: current_time = datetime.now() # Check if enough time has passed if self.dose_history: last_dose = self.dose_history[-1]…

  3. Article Mini projects

    Calculating Escape Velocity in Python

    …a ball upward. It always falls back down, right? But what if you threw it so hard that it never came back? That's escape velocity - the minimum speed needed to break free from a planet's gravity…

  4. Article Mini projects

    Managing Astronaut Medical Data with Python

    …above the content of this article. Feel free to peek ahead if you're curious, but we recommend following along step-by-step for the best learning experience! 1. Setting Up Our Python Environment…

  5. Article Python Fundamentals

    Nested Loops in Python

    …for scan_y in range(10): for scan_x in range(10): # Check if there's a rover at this position rover_found = None for x, y, name in lost_rovers: if x == scan_x and y == scan_y: rover_found = name break…

  6. Article Python Fundamentals

    Python Functions for Beginners

    If you've written even a few lines of Python, you've already used functions. print() is one. So are len() , input() and int() . Somebody wrote them, gave each one a name, and now you can use them…

  7. Article Mini projects

    Base 6 Number System in Python

    If you've read Andy Weir's Project Hail Mary , you probably remember (spoiler alert!) the moment when Ryland Grace tries to communicate with Rocky, the alien engineer from the 40 Eridani star system…

  8. Article Mini projects

    Calculate your weight on different planets in Python

    …a planet. Time to calculate and display the weight: if chosen_planet in planets: gravity = planets[chosen_planet] weight = calculate_weight(mass, gravity) print(f"Your weight on {chosen_planet} would…

  9. Article Mini projects

    Converting Temperatures in Python

    …or inform the user that they entered an incorrect value. if choice == 1: celsius = float(input("Enter the temperature in degrees Celsius: ")) kelvin = celsius_to_kelvin(celsius) print(f"The…

  10. Article Python Fundamentals

    A Practical Guide to Getting Started with Programming

    …Simple algebra (understanding variables) Logic skills (if this, then that) Problem-solving ability How do I learn math for programming? While basic math skills are helpful, you don't need advanced…