Python Answers

Questions answered by Experts: 5 288

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

create a python program

Choices:

a. Calculator

b. Odd or Even

c. Positive or Negative Number Enter your choice: a Enter first number: 10 Enter second number: 5 The sum of 10 and 5 is 15 The difference of 10 and 5 is 5 The product of 10 and 5 is 50 The quotient of 10 and 5 is 2




2. Write your own unique Python program that has a runtime error. Do not copy the program from your textbook or the Internet. Provide the following.



The code of your program.


Output demonstrating the runtime error, including the error message.


An explanation of the error message.


An explanation of how to fix the error.


Find latitude and longitude of first 20 countries with a population greater than or equal to the population limit given below. Use the country details from this dataset.

Your task is to find the sum of the length of all lines (in kms) that can be drawn between co-ordinates of these countries.

  • Assume radius of earth: 6371 km
  • Round length of each line and final result to 2 decimal points
  • If co-ordinates are missing for any country use 0.000 N 0.000 E

Population limit: 300



Consider a square matrix , a size n*n and a integer , x . Calculate the row number , r and column , c or x in a. If the sum of R and C is an even number, find the sum s of all even numbers in the matrix and if the sum of r and c is odd , then find the sum s of all odd numbers in the matrix.

Enter·n:·214

4

1

2


WITH COMMENTS AND EXPLANATION


Create a program with comments that can record the name, gender, and grades of a student in a certain subject. The grades consist of 1st, 2nd, 3rd, and 4th quarters.



The program should be able to do the following:


• Add new student

• Set student grades

• Show all students w/ grades

• Show student grade remarks (PASS or FAILED), passing mark is >= 75

• Search student record


The program should use the following features:


• Array

• Class

• Specific Sorting Algorithm (Bubble, Selection, Insertion, Merge, Shell)

• Specific Searching Algorithm (Linear, Binary, Fibonacci, Jump)


I'm quite into games now, so how about we play In or Out! When a given number is even, the team scores so we shall print "In", but if it's not an even number, then we print "Out". Simple, right?

Give example of chained conditional


1. Time measurement using song duration






Consider that Alice is cycling from point A to point B. During the cycling, Alice is listening to songs in her music player.






Given the following inputs:






1. The distance between A and B in metres






2. The speed at which Alice is traveling in metres per second






3. Duration of each song in her playlist in the






following format: mm:ss






the program should:






• Print the number of the song that Alice is listening when the cycling is completed from A to B






· Print Invalid input if any of the constraints mentioned in the constraints section is violated






Example 1






Consider the following inputs:






2000






5






Now consider the following list of songs:






05:30






02:04

Describe the difference between a chained conditional and a nested conditional. Give your own example of each. Do not copy examples from the textbook.


Deeply nested conditionals can become difficult to read. Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional. 


LATEST TUTORIALS
APPROVED BY CLIENTS