Skip to content

bilaluzunkaya/Python-Module-4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Python-Module-4

Python-Module-4 Assignment

Python Programming - Module 3 Solutions

This repository contains my solutions for the Module 3 programming assignments. This module focuses on the use of while loops, conditional statements, and mathematical simulations.

Exercises Overview

  1. Divisible by Three: A program that prints all numbers divisible by three in the range of 1-1000 using a while loop.
  2. Inches to Centimeters: A converter that continues to transform inches to centimeters until the user enters a negative value.
  3. Smallest and Largest Number: Collects numbers from the user until an empty string is entered, then identifies the minimum and maximum values.
  4. Number Guessing Game: A game where the computer selects a random number between 1-10, and the user guesses until they find it, receiving "Too high" or "Too low" feedback.
  5. Login Simulation: A secure login system that allows up to five attempts for a specific username and password.
  6. Pi Approximation (Monte Carlo Method): An algorithm that estimates the value of $\pi$ by generating random points inside a square and checking if they fall within a unit circle using a while loop.

Key Concepts Applied

  • Infinite Loops & Break Statements: Used in the conversion and login programs to handle user-driven exits.
  • Randomness: Utilizing the random library for both the guessing game and the $\pi$ estimation.
  • Input Validation: Handling empty strings and specific credentials.
  • Mathematical Approximations: Implementing the geometric probability formula: $$\pi \approx 4 \times \frac{n}{N}$$ where $n$ is points inside the circle and $N$ is total points.

About

Python-Module-4 Assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages