Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Logical Programming Problems in Python

This repository contains Python programs that solve various logical programming problems. Each Python file addresses a specific problem or set of problems. Below, you'll find descriptions and explanations for each problem along with their respective Python files.

Q1 - Symmetric Difference of Lists

q1.py

  • Defines three lambda functions for list manipulation.
  • input_list converts input into a list of integers.
  • contains checks if an element is in a list.
  • simetric_dif finds the symmetric difference between two lists using lambda functions.

Q2 - Changing Elements in a List

q2.py

  • Defines two lambda functions.
  • input_list converts input into a list of integers.
  • change_num replaces elements in a list with a new value.
  • Demonstrates how to call change_num with user input.

Q3 - Palindromes in a String

q3.py

  • Checks if a given string contains a palindrome of a specified length.
  • Uses lambda functions is_palindrome and contains_palindrome.
  • Takes input for string and length, then prints "sim" if a palindrome is found, or "nao" if not.

Q4 - Filtering Prime Numbers

q4.py

  • Filters prime numbers from a list of integers using a lambda function.
  • input_list converts input into a list of integers.
  • is_primo checks if a number is prime.
  • Prints prime numbers from the input list.

Q5 - Checking if a Point is Inside a Rectangle

q5.py

  • Defines a lambda function is_inside to check if a point is inside a rectangle.
  • Takes input for the rectangle and point coordinates.
  • Prints "True" if the point is inside the rectangle; otherwise, it prints "False."

You can explore each problem separately by opening the corresponding Python file. Feel free to use and modify these Python programs as needed to suit your requirements.