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

Python Control Structures Activities

The document outlines a series of Python programming activities focused on control structures. Activities include determining the sign of a number, checking voting eligibility, classifying angles, solving quadratic equations, checking leap years, printing multiplication tables, calculating factorials, generating Fibonacci sequences, summing prime numbers, and summing inputs until a negative number is encountered. Each task emphasizes the use of conditional statements, loops, and user input.

Uploaded by

Jangam Swathi
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)
7 views1 page

Python Control Structures Activities

The document outlines a series of Python programming activities focused on control structures. Activities include determining the sign of a number, checking voting eligibility, classifying angles, solving quadratic equations, checking leap years, printing multiplication tables, calculating factorials, generating Fibonacci sequences, summing prime numbers, and summing inputs until a negative number is encountered. Each task emphasizes the use of conditional statements, loops, and user input.

Uploaded by

Jangam Swathi
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

Python Control Structures Activities

1. Write a Python program that takes a number as input and determines


whether it is positive, negative, or zero. Use if, else, and elif statements
for decision-making.

2. Write a Python program that takes a user's age as input and prints whether
they are eligible to vote or not (considering the legal voting age is 18).

3. Implement a program that classifies a given angle (input in degrees)


into categories such as acute, right, obtuse, or invalid.

4. Write a program that takes coefficients of a quadratic equation as input


and solves for the roots. Handle both real and complex roots.

5. Write a program that checks if a given year is a leap year or not.


Implement the logic for leap years (divisible by 4 but not by 100 unless
also divisible by 400).

6. Implement a program that prints the multiplication table for a given


number. Allow the user to input the number.

7. Write a Python program that calculates the factorial of a given number


using a loop. Take the number as input.|

8. Develop a program that prints the Fibonacci sequence up to a certain


number of terms. Allow the user to input the number of terms.

9. Write a program to calculate the sum of all prime numbers within a


given range (input by the user).

10. Develop a program that takes numbers as input and calculates the
sum until it encounters a negative number, using the break statement.

You might also like