Question: Exercise 1 ( 3 0 points ) Source code: #input a float value for variable a here #input a float value for variable b here

Exercise 1(30 points) Source code: #input a float value for variable a here #input a float value for variable b here #output the results of addition, subtraction, multiplication and division print ("That's all, folks!") Your task is to complete the code in order to evaluate the results of four basic arithmetic operations. The results have to be printed to the console. You may not be able to protect the code from a user who wants to divide by zero. That's okay, don't worry about it for now. Test your code - does it produce the results you expect? Exercise 2(30 points) Source code: x = float (input ("Enter value for x: ")) # put your code here print ("y=",y) Complete the code in order to evaluate the following expression: The result has to be assigned to y. Be careful! Watch the operators and keep their priorities in mind. Don't hesitate to use as many parentheses as you need. You can use additional variables to shorten the expression (but it's not necessary). Test your code carefully! Exercise 3(40points) Source code: hour - int (input ("Starting time (hours): ")) mins = int(input ("Starting time (minutes): ")) dura - int (input ("Event duration (minutes): ")) # put your code here Your task is to prepare a simple code able to evaluate the end time of a period of time, given as a number of minutes (it could be arbitrarily large). The start time is given as a pair of hours (0..23) and minutes (0..59). The result has to be printed to the console. For example, if an event starts at 12:17 and lasts 59 minutes, it will end at 13:16 Don't worry about any imperfections in your code - it's okay if it accepts an invalid time - the most important thing is that the code produces valid results for valid input data. Test your code carefully! Hint: using the % operator may be the key to success! Example input 121759 Example output 13:16 Example input 2358642 Example output 10:40 Example input 012939 Example output 1:0 Exercise 1(30 points) Source code: #input a float value for variable a here #input a float value for variable b here #output the results of addition, subtraction, multiplication and division print ("That's all, folks!") Your task is to complete the code in order to evaluate the results of four basic arithmetic operations. The results have to be printed to the console. You may not be able to protect the code from a user who wants to divide by zero. That's okay, don't worry about it for now. Test your code - does it produce the results you expect? Exercise 2(30 points) Source code: x = float (input ("Enter value for x: ")) # put your code here print ("y=",y) Complete the code in order to evaluate the following expression: The result has to be assigned to y. Be careful! Watch the operators and keep their priorities in mind. Don't hesitate to use as many parentheses as you need. You can use additional variables to shorten the expression (but it's not necessary). Test your code carefully! Exercise 3(40points) Source code: hour - int (input ("Starting time (hours): ")) mins = int(input ("Starting time (minutes): ")) dura - int (input ("Event duration (minutes): ")) # put your code here Your task is to prepare a simple code able to evaluate the end time of a period of time, given as a number of minutes (it could be arbitrarily large). The start time is given as a pair of hours (0..23) and minutes (0..59). The result has to be printed to the console. For example, if an event starts at 12:17 and lasts 59 minutes, it will end at 13:16 Don't worry about any imperfections in your code - it's okay if it accepts an invalid time - the most important thing is that the code produces valid results for valid input data. Test your code carefully! Hint: using the % operator may be the key to success! Example input 121759 Example output 13:16 Example input 2358642 Example output 10:40 Example input 012939 Example output 1:0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!