Answer:
- import datetime
-
- def get_year_of_birth():
- age = int(input("Enter your age: "))
- current_year = datetime.datetime.now().year
- year_of_birth = current_year - age
- return year_of_birth
-
- 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).
The if-else statement as based on python 3.8 is given below
if user_tickets < 5:
num_tickets = 1
else:
num_tickets = user_tickets
Note that if this code is to work properly, a person need to first declare user_tickets before the if-else statements.
<h3>What is this if statement?</h3>
The if/else statement is known to be that which carry out a block of code if a given condition is true.
Note that If the condition is false, a given or another block of code iis one that can be executed.
Learn more about if-else statements from
brainly.com/question/18736215
#SPJ1
Answer:
sorry if it is too late but I think it is d
Explanation:
Answer:
B
Explanation:
It's B because why would it me made to play video games
The program that computes the area of a circle is represented as follows:
x = int(input("Write the length of the radius of the circle: "))
area = 3.14 * x**2
print(area)
The code is written in python
<h3>Code explanation:</h3>
- The first line of code ask the user to input the length of the radius. The variable x is used to store the user's input.
- The variable "area" is used to store the arithmetic manipulation of area of a circle.
- Then, we print the variable "area". This will print the actual area of the circle with the particular radius you inputted.
learn more on python program: brainly.com/question/16398286?referrer=searchResults