Keeping in mind there are 86400 seconds per day, write a program that calculates how many seconds there are in a week, if a week is 7 days. Print the result on the screen.
Note: Your result should be in the format of just a number, not a senten
Answers
Answer:
Week =7 days
Day=86400 seconds
Seconds in week=86400×7=604800
Given
Seconds per Day = 86400 seconds
Days in a week = 7 days
To calculate
Seconds in a week = ?
Python Códe
secondsPerDay = 86400;
daysInAWeek = 7;
secondsInAWeek = daysInAWeek * secondsPerDay;
print(secondsInAWeek)
Output of the Códe
604800
There are 604800 seconds in a week having 7 days.
Extra Information
To calculate seconds in a Day
Seconds in a Day = Hours in a Day * Minutes in an Hour * Seconds in a Minute
Seconds in a Day = 24 * 60 * 60
Seconds in a Day = 86400 seconds
There are various types of Arithmetic Operators in Python such as
(A) + operator
It is used to add two operands
Example
print(5+3)
The output will be 8
(B) - operator
It is used to subtract two operands
Example
print(5-3)
The output will be 2
(C) * operator
It is used to multiply two operands
Example
print(5*3)
The output will be 15
(D) / operator
It is used to divide the operands
Example
print(5/3)
The output will be 1.6666666666666667
(E) // operator
It is used to divide the operands
Example
print(5//3)
The output will be 1
(F) % operator
It is used to divide the operands and return the remainder
Example
print(5%3)
The output will be 2
(G) ** operator
It is used to raise one operand to the power of another.
Example
print(5**3)
The output will be 125
In mathematical terms, it will be like 5³ which is 125
Python is created by Guido van Rossum and came into existence in 1991. It is a high-level and general programming language. It is a very lucid programming language as it has a good language construct and object-oriented approach. It is dynamically typed and garbage-collected.