0% found this document useful (0 votes)
6 views

Write a Python program to swap the values of two variables using a temp variable

The document outlines a series of Python programming tasks, including variable manipulation, user input handling, and mathematical calculations. It covers topics such as swapping values, checking even/odd numbers, leap years, and calculating sums and factorials. Each task is designed to enhance programming skills and understanding of Python syntax.

Uploaded by

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

Write a Python program to swap the values of two variables using a temp variable

The document outlines a series of Python programming tasks, including variable manipulation, user input handling, and mathematical calculations. It covers topics such as swapping values, checking even/odd numbers, leap years, and calculating sums and factorials. Each task is designed to enhance programming skills and understanding of Python syntax.

Uploaded by

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

1.

Write a Python program to swap the values of two variables using a temp variable

2. Create a variable x with value 5. Double its value and print the result.

3. Convert the integer 100 into a string and print its type.

4. Write a Python program to check if a number entered by the user is even or odd.

5. Create a program that checks if a year entered by the user is a leap year.

6. Write a Python script to compare three numbers and print the largest one.

7. Write a for loop to calculate the sum of numbers from 1 to 50.

8. Create a Python program that prints the multiplication table of 7.

10. Write a Python program to find the factorial of a number using a while loop.

11. Create a program that keeps asking the user for a password until they enter "12345"

12. Write a Python script to calculate the sum of all even numbers between 1 and 20 using a while loop.

13. Write a Python program to check if a string is a palindrome.

14. Create a program to count the number of vowels in the string "hello world".

15. Write a program to calculate the sum of all numbers divisible by 3 and 5 between 1 and 100.

You might also like