Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want you to program this homework by python codes 4. Write a program that reads three numbers and prints all the same if they

I want you to program this homework by python codes
4. Write a program that reads three numbers and prints all the same if they are all the same, all different if they are all different, and neither otherwise. 5 pts
a) Your code with comments
b) A screenshot of the execution
Test Cases:
1 1 1 (should print all the same)
1 2 3 (should print all are different)
1 1 2 (should print neither)
5. When two points in time are compared, each given as hours (in military time, ranging from 0 to 23) and minutes, the following pseudocode determines which comes first. 5 pts
If hour1 < hour2
time 1 comes first
Else if hour 1 and hour 2 are the same
If minute 1 < minute 2
time 1 comes first.
Else if minute 1 and minute 2 are the same
time 1 and time 2 are the same.
Else
time 2 comes first
Else
time 2 comes first.
Write a program that prompts the user for two points in time (hours and minutes) and prints the time that comes first, then the other time.
a) Your code with comments
b) A screenshot of the execution
Test Cases:
14:12 16:30 (should print Time 1 comes first)
15:35 15:11 (should print Time 2 comes first)
20:23 8:15 (should print Time 2 comes first)
6. Write a program that reads in three strings and sorts them lexicographically. Do NOT user the sort function. 5 pts
Enter string 1: Charlie
Enter string 2: Able
Enter string 3: Baker
Able
Baker
Charlie
a) Your code with comments
b) A screenshot of the execution
Test Cases:
Able, Baker, Charlie
Baker, Charlie, Able
Charlie, Able, Baker
Able, Charlie, Baker
Baker, Able, Charlie
Charlie, Baker, Able

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions