0% found this document useful (0 votes)
5 views2 pages

Python Age and Student Status Check

The document outlines a Python task involving variable declaration and conditional statements. It requires creating a program that checks a person's age and student status to print appropriate messages. An example output is provided to illustrate the expected results based on different variable values.

Uploaded by

mohamedabdi45352
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)
5 views2 pages

Python Age and Student Status Check

The document outlines a Python task involving variable declaration and conditional statements. It requires creating a program that checks a person's age and student status to print appropriate messages. An example output is provided to illustrate the expected results based on different variable values.

Uploaded by

mohamedabdi45352
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

age = 25

name = "Mohamed"
is_student = False
if age < 18:
print("Hello Mohamed, you are a minor.")
else:
print("Hello Mohamed, you are an adult.")
if is_student is True:
print("You are eligible for a student discount")
else:
print("You are not eligible for a student discount")
PS C:\Users\HP\OneDrive\Desktop\MY PROJECTS\PYTHON> python [Link]

Hello Mohamed, you are an adult.

You are not eligible for a student discount

PS C:\Users\HP\OneDrive\Desktop\MY PROJECTS\PYTHON>

21/11/2024 Kodarit 2 task


Python Task: Variables and If Conditions
Task Description
Create a Python program that performs the following:
Variable Declaration:
Declare three variables: age, name, and is_student.
Assign appropriate values to these variables. For example, age could be an
integer, name a string, and is_student a boolean.
Conditional Statements:
Write an if-else statement that checks the value of age.
If age is less than 18, print a message saying, "Hello [name], you are a
minor."
If age is 18 or older, print a message saying, "Hello [name], you are an
adult."
Add another condition to check if is_student is True.
If is_student is True, print "You are eligible for a student discount."
If is_student is False, print "You are not eligible for a student discount."
Example Output
If age is 17, name is "Alex", and is_student is True, the output should be:
Hello Alex, you are a minor.
You are eligible for a student discount

You might also like