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
MrMuchimi
2 years ago
10

Many people keep time using a 24 hour clock (11 is 11am and 23 is 11pm, 0 is midnight). If it is currently 13 and you set your a

larm to go off in 50 hours, it will be 15 (3pm). Write a Python program to solve the general version of the above problem. Your program should first prompt the user for the time now (in hours) and for the number of hours to wait for the alarm, then store those values as type int variables time_now and wait_time respectively, and finally print the time on the 24 hour clock when the alarm will go off.
Computers and Technology
1 answer:
lozanna [386]2 years ago
6 0

Answer:

<em>The program written in Python is as follows;</em>

time_now = int(input("Time: "))

wait_time = int(input("Alarm: "))

time_now = time_now + wait_time%24

if time_now < 12:

     print(str(time_now)+"am")

else:

     time_now = time_now - 12

     print(str(time_now)+"pm")

Explanation:

This line prompts user for current time

time_now = int(input("Time: "))

This line prompts user for the alarm hours

wait_time = int(input("Alarm: "))

This line calculates the time of the alarm

time_now = time_now + wait_time%24

The following if statement determines if the time will be am or pm

If the time is less than 12, then the time will be in am

<em>if time_now < 12: </em>

<em>      print(str(time_now)+"am") </em>

If otherwise,  then the time will be in pm

<em>else: </em>

<em>      time_now = time_now - 12 </em>

<em>      print(str(time_now)+"pm")</em>

<em></em>

You might be interested in
What are the core scripting and coding technolies used to build ai platforms?
boyakko [2]
<span>Artificial Intelligence is a huge field. </span>
4 0
3 years ago
When you use the tilde operator (~ in a url for the attribute of a server control, it represents the _____ directory of the webs
Verizon [17]
The tilde operator represents the root directory of the website.
4 0
3 years ago
Question #2
UNO [17]

Explanation:

by staying late to help people aswell as being their and putting full effort into it

because the others arent helping they are only only just reminding

4 0
2 years ago
Read 2 more answers
What is the purpose of a div?
taurus [48]

Answer:

I'd choose A, all of the above.

Reasoning Why:

I'll be taking you on a step to step process on why I inputted the answer.

The <div>, is basically like a container that you can group tougher, why this is great is because you can edit the div using a background-color effecting that group such as the following..

EXAMPLE OF BACKGROUND-COLOR DIV (background-color)

<!DOCTYPE html>

<html>

<head>

<title>Brainly Example | HTML Div</title>

<style>

#byexample{

background-color:red;

/*Example of the Background-color attrib*/

/*You can also use the background-image attrib, however I recommend you checkout W3Schools, on that topic.*/

}

</style>

</head>

<body>

<div id="byexample">

<p>Just some random text to demonstrate.</p>

</div>

</body>

</html>

END OF EXAMPLE

You can also, in the <div> change multiple styles of an element in the div. However, if do want to change the styles of a single element you would need to nest it.

<!DOCTYPE html>

<html>

<head>

<title>Brainly Example | HTML Div</title>

<style>

#byexample #text{

background-color:red;

color:yellow;

}

</style>

</head>

<body>

<div id="byexample">

<p id="text">Just some random text to demonstrate.</p>

</div>

</body>

END OF EXAMPLE

Lastly, you can group elements using divs, as stated in openclassroom (website).

Anyways, I hope this helped!

Happy coding!

5 0
3 years ago
Int [] val = { 3, 10, 44 };
Shtirlitz [24]

Answer:

4) 3 11 44

Explanation:

Given data

int [] val = { 3, 10, 44 };

The total number of parameters of given array are 3, so total length of array is also 3.

The indexing of array starts with '0', Therefore the indexes of array with length zero are: {0,1,2}

The value of array at index 0 is = 3

similarly,

value at index 1 = 10

value at index 2 = 44

Here, Int i = 1 is storing the value '1' in integer variable i.

In addition to that, any value of index 'i' of an array is selected using array[i].

Therefore,

val[i] is selecting the value of array located at index '1' because i = 1.

val[i] = val[1] = 10

val[i]+1 is selecting the value of array located at index 'i' that is (1) and adding 1 to it

=> val[i] = 10

=> val[i]+1 = 10+1 = 11

Finally,

val[i] = val[i]+1; is copying the val[i]+1 = 11 to value placed at index 1 (10). Hence, the output would be {3 11 44}. So 4th option is correct.

6 0
2 years ago
Other questions:
  • In a five-choice multiple-choice test, which letter is most often the correct answer?
    7·2 answers
  • Find every number from 1 to n (inclusive) that is a palindrome which starts with the digit 3. Do not user a helper function.
    10·1 answer
  • 3. Before you get ready to go diving, you want to explore the area. You see a small snowpack across a small bridge, a short walk
    11·1 answer
  • Downloading files is safe for most types of files except Select one: a. documents. b. pictures. c. executable files. d. music fi
    7·1 answer
  • Grandma Ester normally gives you hugs for your birthday - one for every year old you are. When you turned 15, she squished you w
    8·1 answer
  • ____ the styles allows the designer to start from a known baseline, confident that no unwanted styles will creep in from any bro
    6·1 answer
  • Why do people still use Intel HD graphics for gaming?
    8·1 answer
  • Introduction to computing systems: from bits and gates to c and beyond
    7·1 answer
  • What maintains data about various types of objects, events, people, and places?
    10·1 answer
  • Resource _____ let you view, manage, and automate tasks on multiple aws resources at a time.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!