This repository contains four Python codes, each with a different functionality. Below is a brief description of each code.
This program takes a number as input from the user and calls either the countdown
or countup
function based on the input. The countdown
function prints the numbers from the input down to 1, and then prints "Blastoff!", while the countup
function prints the numbers from the input up to 1, and then prints "Blastoff!". If the input is zero, the program prints "Blastoff!" since the countdown
function already prints "Blastoff!" for zero or negative inputs.
This program defines a function print_volume
that calculates and prints the volume of a sphere based on its radius. The program calls this function with three different radius values and prints the volume of each sphere.
This program defines a function even_or_odd
that takes a number as input and returns a string indicating whether the number is even or odd. The program calls this function with three different input values and prints the output.
This program asks the user for their age, checks if they are old enough to vote, and prints a message indicating whether they are eligible to vote or not. The program uses input
to get the user's age as a string, and then uses int
to convert it to an integer for the comparison.
Thank you for checking out this Python code collection!