Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

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

Include example Python code and output with your answers.

  • If you are trying to print a string, what happens if you leave out one of the quotation marks or both and why?
  • You can use a minus sign to make a negative number like -2. What happens for each of the following and why?

>>> 2++2

>>> 2--2

>>> 2+-2

>>> 2-+2

  • In math notation, leading zeros are OK, as in 02. What happens if you try this in Python and why?
  • What happens if you have two values with no operator and a space in between them and why?

Create a class called Time that has separate int member data for hours, minutes, and seconds. One constructor should initialize this data to 0, and another should initialize it to fixed values. Another member function should display it, in 11:59:59 format. The final member function should add two objects of type time passed as arguments. 



Mean, Median and Mode

Given a list of integers, write a program to print the mean, median and mode.

Mean - The average value of all the numbers.

Median - The mid point value in the sorted list.

Mode - The most common value in the list. If multiple elements with same frequency are present, print all the values with same frequency in increasing order.Input


The input will be a single line containing space-separated integers.Output


The first line of output should contain the mean, round off the value to 2 decimal places.

The second line of output should contain the median, round off the value to 2 decimal places.

The third line of output should contain the mode.

Mean should always be a float value.

Median should be a float value when there are even number of elements, otherwise should be an integer value.

Sample Input 1

2 4 5 6 7 8 2 4 5 2 3 8

Sample Output 1

Mean: 4.67

Median: 4.5

Mode: 2











Sum of Prime Numbers In the Input

Given a list of integers, write a program to print the sum of all prime numbers in the list of integers.

Note: One is neither prime nor composite number.Input


The input will be a single line containing space-separated integers..Output


The output should be a single line containing the sum of all prime numbers from 1 to N.Explanation


For example, if the given list of integers are

2 4 5 6 7 3 8


As 2, 3, 5 and 7 are prime numbers, your code should print the sum of these numbers. So the output should be 17.

Sample Input 1

2 4 5 6 7 3 8

Sample Output 1

17

Sample Input 2

65 87 96 31 32 86 57 69 20 42

Sample Output 2

31




Sum of Prime Numbers from M to N

Given two integers M and N, write a program to print the sum of prime numbers from M to N. (Both M and N are inclusive).Input


The first line of input will contain a positive integer (M).

The second line of input will contain a positive integer (N).Output


The output should be a single line containing the sum of prime numbers from M to N.Explanation


For example, if the given M and N are 5 and 11, as all the prime numbers from 5 to 11 are 5, 7, and 11. So the output should be sum of these primes (5+7+11), which is 23.


Similarly, if the given numbers are M is 18 and N is 40, as all the prime numbers from 18 to 40 are 19, 23, 29, 31,and 37. So the output should be sum of these primes (19+23+29+31+37), which is 139.

Sample Input 1

5

11

Sample Output 1

23

Sample Input 2

18

40

Sample Output 2

139




Index of Last Occurrence

Write a program to print the index of the last occurrence of the given number N in the list.Input


The first line of input will contain space-separated integers.

The second line of input will contain an integer N.Output


The output should be the index of the last occurrence of the number N.Explanation


For example, if the given list of numbers and N are

2 4 5 6 7 8 2 4 5 2 3 8
2


Number 2 present at index locations 0, 6, 9, as the last occurrence, is at index 9. So the output should be 9.

Sample Input 1

2 4 5 6 7 8 2 4 5 2 3 8

2

Sample Output 1

9

Sample Input 2

65 87 96 31 32 86 57 69 20 42 32 32

32

Sample Output 2

11




 Write a program that uses an array of string objects to hold the five student names, an array of one character to hold the five students’ letter grades, and five arrays of doubles to hold each student’s set of test scores and average score. The program should allow the user to enter each student’s name and his or her four test scores. The program should store each student’s information in the arrays [20 points]. It should then calculate and display each student’s average test score [20 points] and a letter grade based on the average [20 points]. Input Validation: Do not accept test scores less than 0 or greater than 100 [10 points]


 Write a program that uses an array of string objects to hold the five student names, an array of one character to hold the five students’ letter grades, and five arrays of doubles to hold each student’s set of test scores and average score. The program should allow the user to enter each student’s name and his or her four test scores. The program should store each student’s information in the arrays [20 points]. It should then calculate and display each student’s average test score [20 points] and a letter grade based on the average [20 points]. Input Validation: Do not accept test scores less than 0 or greater than 100 [10 points]


Produce an entity relationship model for the proposed database system for Domingo Roof Works.  Use Integration Definition for Information Modeling (IDEF1X) standard.

create JavaScript program for both task in html coding


Assignment #10 – Arrays

Task#1 – Favourite Places


Ask the user to enter ten of their places they have visited in their life. Once they have entered there favourite places, display the results. Use an array to store the ten favourite places.


Task#2 – Favourite Actor


Ask the user to enter their favourite actor and the role that the actor played. Save the actors in one array and the roles in another array. Ask for four favourite actors. Then ask the user for one of their favorite actors. Find the role that the actor played and display it to the screen.


LATEST TUTORIALS
APPROVED BY CLIENTS