Skip to content

masooddahmedd/python-questions-with-answers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Python Questions with Answers

Welcome to the python-questions-with-answers repository! This repository contains a collection of Python questions along with their respective answers. There are two files: one with the questions and the other with the answers.

Instructions

  1. Before checking the answers, we encourage you to try solving the questions on your own. This will give you an opportunity to practice your Python skills and problem-solving abilities.

  2. Questions are listed in the python_test_questions.ipynb file. Each question is accompanied by a description, and you are expected to write Python functions to solve them.

  3. Once you have attempted the questions, you can check your solutions against the provided answers in the python_test_answers.ipynb file.

Questions

Question 1: Vowel Counter

Write a Python function that takes a string as input and returns the count of vowels (a, e, i, o, u) in the string. Ignore case sensitivity.

Question 2: Unique Elements

Given a list of integers, write a Python function to return a new list containing only the unique elements from the original list, preserving their order.

Question 3: Palindrome Check

Write a Python function that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same backward as forward. (Example: "abba")

Question 4: Prime Number Check

Write a Python function to determine if a given positive integer is a prime number. A prime number is only divisible by 1 and itself.

Question 5: Factorial Calculation

Implement a Python function to calculate the factorial of a given non-negative integer 'n'.

Question 6: Common Elements in Lists

Write a Python function that takes two lists as input and returns a new list containing elements that appear in both lists, without any duplicates.

Question 7: CamelCase to snake_case Conversion

Implement a Python function that converts a CamelCase string to snake_case. For example, "CamelCaseString" should become "camel_case_string."

Feel free to explore and solve these Python questions to sharpen your programming skills. Happy coding!

About

Python Quiz: Questions and Answers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published