1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Keith_Richards [23]
3 years ago
7

Create a Python program by defining a function that calculates the year of birth of a person whose age is known to you.(You may

use an input statement to ask the user to enter their age).
Computers and Technology
1 answer:
Alchen [17]3 years ago
3 0

Answer:

  1. import datetime
  2. def get_year_of_birth():
  3.    age = int(input("Enter your age: "))  
  4.    current_year = datetime.datetime.now().year  
  5.    year_of_birth = current_year - age  
  6.    return year_of_birth  
  7. print(get_year_of_birth())

Explanation:

Firstly, we import datetime module as we need it to get the current year (Line 1).

Next, create a function named it as get_year_of_birth (Line 3). Prompt user to input age and assign it to a variable (Line 4). Next, we use now() method from datetime module to get the current date and time and extract the year component (Line 5).  At last, calculate the year of birth by subtracting the current_year with age and return it as output (Line 6-7).

You might be interested in
What is the best Genshin impact ship? My favorite is Xiao x Lumine. Put yours bellow.
denis-greek [22]

XIAO X LUMINE AAA

Explanation:

6 0
3 years ago
Read 2 more answers
How do the portrait and landscape page orientations help in the process of printing a worksheet?
zmey [24]
Most worksheets are portrait orientation. A few of them are horizontal, but it depends on what you want to do.
6 0
3 years ago
Identify the potential impact to IT security of incorrect configuration of firewall policies and third- party VPNs
yan [13]

Answer:

why is it necessary to fight against social evils and problem

5 0
3 years ago
100 POINTS!!!!
Alisiya [41]

Answer:

☆<em>intellectual property</em>☆

<u>intangible </u><u>a</u><u>s</u><u>s</u><u>e</u><u>t</u><u>s</u><u> </u><u> that result from intellectual</u><u> </u><u>p</u><u>r</u><u>o</u><u>p</u><u>e</u><u>r</u><u>t</u><u>y</u><u> </u><u>.</u>

<u>☆</u><u>I</u><u>n</u><u>t</u><u>a</u><u>n</u><u>g</u><u>i</u><u>b</u><u>l</u><u>e</u><u>☆</u><u>;</u>

<u>s</u><u>o</u><u>m</u><u>e</u><u>t</u><u>h</u><u>i</u><u>n</u><u>g</u><u> </u><u>t</u><u>h</u><u>a</u><u>t</u><u> </u><u>c</u><u>a</u><u>n</u><u>n</u><u>o</u><u>t</u><u> </u><u>b</u><u>e</u><u> </u><u>t</u><u>o</u><u>u</u><u>c</u><u>h</u><u>e</u><u>d</u><u>.</u>

<em>P</em><em>l</em><em>e</em><em>a</em><em>s</em><em>e</em><em> </em><em>M</em><em>a</em><em>r</em><em>k</em><em>☆</em>

<em>A</em><em>r</em><em>i</em><em>a</em><em>♡</em>

5 0
3 years ago
ནས་ད་ དང ་ ་ ་ ་ ་ Az - . Al &amp; Co (NO) - Cat Al (NO) 0 --- - 2N: H2 +0 h20​
Tamiku [17]

Can you be more clear???

7 0
3 years ago
Other questions:
  • This question involves the creation of user names for an online system. A user name is created based on a user’s first and last
    13·1 answer
  • What is deshtop in desktop publishing
    11·1 answer
  • What is intellectual property?
    7·1 answer
  • Select the correct answer. One of the functions of a data warehouse is to change table names to meaningful names. Which name is
    13·1 answer
  • Passwords are usually alphanumeric and usually cannot contain spaces or ________.
    10·2 answers
  • Jason is driving 1,050 miles from Miami, Florida, to New
    15·1 answer
  • Consider a system that contains 32K bytes. Assume we are using byte addressing, that is assume that each byte will need to have
    10·1 answer
  • B) Describe the computer processing that is required to maintain the correct growing<br>conditions.​
    13·1 answer
  • Please help with my Python code - Functions
    9·1 answer
  • Write a function called changeCharacter that takes three parameters – a character array, its size, and the replacement character
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!