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

Python If-Else and For Loop Challenges

The document outlines a series of intermediate Python programming challenges involving control structures like if-else statements and for loops. Tasks include printing numbers with specific conditions, identifying prime numbers, counting positive and negative integers, and manipulating strings. Each challenge aims to enhance programming skills through practical exercises.

Uploaded by

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

Python If-Else and For Loop Challenges

The document outlines a series of intermediate Python programming challenges involving control structures like if-else statements and for loops. Tasks include printing numbers with specific conditions, identifying prime numbers, counting positive and negative integers, and manipulating strings. Each challenge aims to enhance programming skills through practical exercises.

Uploaded by

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

Intermediate Challenges: If-Else + For Loop (Python)

1. Print all numbers from 1 to 100. For multiples of 3, print "Fizz";


for multiples of 5, print "Buzz"; and for multiples of both, print "FizzBuzz".

2. Take an integer n as input. Print all prime numbers from 2 to n.

3. Given a list of integers, count how many are positive, negative, and zero.

4. Write a program that checks numbers from 1 to 50.


- If the number is even, print "<number> is even"
- If odd, print "<number> is odd"

5. Take a string input. Print only the vowels in the string, one per line.

6. For numbers 1 to 30:


- If divisible by 4, print "Div by 4"
- Else if divisible by 6, print "Div by 6"
- Else print the number itself

7. Write a program that prints the factorial of a number n using a for loop.

8. Given a list of integers, print only those that are divisible by both 2 and 3.

9. Take a sentence as input. Count how many words have more than 5 letters.

10. From 1 to 100, print all numbers but skip those divisible by 7.

You might also like