Computer Science, asked by kapishgarg7b30, 1 day ago

D. Write the following programs in Python:
1. A program that receives name and age from the user. The program should
display whether the person can vote or not. The voting age is 18. The name
of the user should also be displayed with a greeting.
her from the user. Display the

Answers

Answered by salunkheprashant437
0

please someone answer please i also need same question please help please its too much needed

Answered by Anonymous
3

Explanation:

Approach # 1:

The naive approach to find the current age in years is to find the difference between the current year and birth year. Refer the Naive approach from here.

Approach #2:

Using datetime module

Python provides datetime module to deal with all datetime related issues in python. Using datetime we can find the age by subtracting birth year from current year. Along with this, we need to focus on the birth month and birthday. For this, we check if current month and date are less than birth month and date. If yes subtract 1 from age, otherwise 0.

Similar questions