Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Python Assignment 5 – Loops & Pattern Programming

A collection of beginner-to-intermediate Python programs focused on mastering loops, nested loops, pattern printing, functions, string manipulation, and algorithmic thinking.

This assignment emphasizes understanding the logic behind iteration, rather than simply memorizing syntax. Every problem is implemented using appropriate looping techniques (for and while) and demonstrates multiple approaches wherever applicable.


📌 About

This repository contains solutions to fundamental Python programming exercises covering:

  • Loop control (for & while)
  • Nested loops
  • Star pattern printing
  • Functions
  • Mathematical algorithms
  • String processing
  • Basic problem-solving techniques

The goal of this assignment is to build a strong foundation in iteration and develop logical thinking required for Data Structures & Algorithms, Automation, Data Analysis, and Software Development.


🚀 Topics Covered

🔁 Loop Basics

  • Print output on the same line
  • end="" parameter
  • while loop fundamentals
  • for loop fundamentals

⭐ Pattern Printing

Right Triangle

  • Using for loop
  • Using nested loops

Reverse Right Triangle

  • Using for loop
  • Using nested loops

Pyramid (Normal Triangle)

  • Using string multiplication
  • Using nested loops
  • Space and star alignment logic

🧮 Factorial of a Number

Without Function

  • Using for loop
  • Using while loop

With Function

  • Using for loop
  • Using reverse while loop

🔤 String Problems

Count Vowels

  • Using for loop
  • Using while loop
  • Handling uppercase and lowercase characters

Longest Word in a Sentence

  • Using split()
  • Comparing word lengths

🔢 Fibonacci Series

  • First N Fibonacci numbers
  • Using for loop
  • Using while loop
  • Understanding variable shifting (a, b, next_num)

📂 Assignment Structure

Assignment-5/
│
├── Loop Basics
│   ├── Same Line Output (while)
│
├── Pattern Printing
│   ├── Right Triangle
│   ├── Reverse Right Triangle
│   ├── Pyramid
│   ├── Nested Loop Patterns
│
├── Factorial
│   ├── With Function
│   ├── Without Function
│   ├── For Loop
│   └── While Loop
│
├── String Programs
│   ├── Count Vowels
│   └── Longest Word
│
└── Fibonacci Series
    ├── For Loop
    └── While Loop

🛠 Concepts Practiced

  • for loops
  • while loops
  • Nested loops
  • Loop counters
  • Conditional statements (if, else)
  • String indexing
  • String methods
  • split()
  • len()
  • Functions
  • Return statements
  • Variable updates
  • Pattern logic
  • Mathematical algorithms

🎯 Learning Outcomes

After completing this assignment, you will be able to:

  • Understand the difference between for and while loops.
  • Solve pattern-printing problems using nested loops.
  • Build mathematical algorithms using iteration.
  • Traverse strings efficiently.
  • Write reusable functions.
  • Apply logical thinking to programming problems.
  • Strengthen problem-solving skills for coding interviews.

▶️ Example Programs

  • Print numbers in the same line
  • Right triangle pattern
  • Reverse triangle pattern
  • Pyramid pattern
  • Factorial using loops
  • Factorial using functions
  • Count vowels in a string
  • Find the longest word in a sentence
  • Generate Fibonacci sequence

💡 Skills Demonstrated

  • Python Fundamentals
  • Iteration
  • Nested Iteration
  • Pattern Programming
  • String Processing
  • Algorithm Design
  • Logical Thinking
  • Clean Code Practices

🧑‍💻 Technologies Used

  • Python 3.x
  • VS Code

📖 Author

Ankit Rai

Aspiring SQL Developer | Data Analyst

Currently learning:

  • Python
  • SQL
  • Power BI
  • Excel
  • Data Analytics

⭐ If you found this repository useful, consider giving it a Star.

About

Hands-on Python programs covering loops, pattern printing, factorial, Fibonacci, string operations, and logical problem-solving.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages