0% found this document useful (0 votes)
2 views1 page

Week 2 Exercises

The document outlines a series of Python programming exercises for Week 2, including tasks such as printing 'Hello, World!', calculating areas, converting temperatures, and generating random numbers. It also includes functions for checking palindromes, calculating factorials, and finding prime numbers, among others. The exercises aim to enhance basic programming skills and problem-solving abilities in Python.

Uploaded by

mayurimalviya461
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Week 2 Exercises

The document outlines a series of Python programming exercises for Week 2, including tasks such as printing 'Hello, World!', calculating areas, converting temperatures, and generating random numbers. It also includes functions for checking palindromes, calculating factorials, and finding prime numbers, among others. The exercises aim to enhance basic programming skills and problem-solving abilities in Python.

Uploaded by

mayurimalviya461
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Week 2: Python Basic Exercises

Provide the file including successfully executable codes for the following tasks:

1. Write a program that prints "Hello, World!" to the console.

2. Calculate the area of a rectangle given its length and width.

3. Convert temperature from Celsius to Fahrenheit and vice versa.

4. Create a list of numbers and print the sum of all the elements.

5. Write a program to check if a given number is even or odd.

6. Generate a random number between 1 and 100 and ask the user to guess it.

7. Write a function to check if a given string is a palindrome.

8. Calculate the factorial of a given number.

9. Write a program to find the largest element in a list.

10. Create a simple calculator that can perform addition, subtraction, multiplication, and

division.

11. Write a function to find the square root of a number using Newton's method.

12. Reverse a given list without using the reverse() method.

13. Write a program to find all the prime numbers between 1 and 100.

14. Calculate the Fibonacci sequence up to a given number.

15. Write a function to count the number of vowels in a given string.

16. Check if a given year is a leap year.

17. Remove duplicates from a list without using sets.

18. Write a program to sort a list of numbers using bubble sort.

19. Create a dictionary of names and ages, and print the name of the oldest person.

20. Write a program to find the least common multiple (LCM) of two numbers.

Good Luck!!!

You might also like