Skip to content

Google collab beginner‑friendly Python exercises covering loops, conditional statements, string manipulation, and list operations — designed to build strong foundational programming skills through practical examples

Notifications You must be signed in to change notification settings

Josephine-Analytics/Loops-and-conditional-Statements-with-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Loops and Conditional Statements with Python

This notebook contains solutions to various basic Python programming exercises, covering fundamental concepts such as string and list manipulation, conditional statements, and loops.

  1. String Slicing: (Extracting a portion of a string by specifying start, end, and step indices) used for extracting the first 5 characters from a string.
  2. List Indexing: (Accessing elements in a list by their numerical position) used for getting the last element of a list.
  3. String Reversal: (Using slicing with a step of -1 to reverse the order of characters) used for reversing a string.
  4. List Slicing: (Extracting a sub-list by specifying a range of indices) used for printing elements at even indices from a list of numbers.
  5. List Modification: (Changing the value of an element at a specific index in a list) used for changing the value of the third element in a list.
  6. Tuple Access: (Retrieving elements from a tuple using their indices) used for printing the second and last elements of a tuple.
  7. Type Conversion: (Changing data from one type to another, e.g., tuple to list) used for converting a tuple into a list.
  8. Conditional Logic (if-elif-else): (Using if, elif, and else statements to execute code based on multiple conditions) used for checking if a number is positive, negative, or zero.
  9. Conditional Logic (if-else): (Using if and else statements to execute code based on a binary condition) used for checking if a number is even or odd.
  10. For Loop: (Iterating over a sequence of elements or a range of numbers) used for printing numbers from 1 to 20.
  11. While Loop: (Repeatedly executing a block of code as long as a condition is true) used for printing numbers from 10 to 1.
  12. Loop for Summation: (Using a loop to iteratively add up elements) used for finding the sum of all elements in a list.
  13. Loop and Condition: (Combining iteration with conditional statements to filter elements) used for printing all numbers divisible by 3 from a list.
  14. List Element Count: (Determining the frequency of a specific value in a list, or all values) used for counting how many times a specific value appears in a list (using count() and collections.Counter).
  15. Loop for Max Value: (Using a loop and conditional statements to compare and find the largest element) used for finding the largest number in a list.

About

Google collab beginner‑friendly Python exercises covering loops, conditional statements, string manipulation, and list operations — designed to build strong foundational programming skills through practical examples

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published