Write a template function that returns the maximum value of three elements passed to the function. Parameters passed to the function can be of int, double, char but all parameters passed are of the same type at point of time. Parameters to be passed to the function as are read as input.
Create a class angle that includes three member variables: an int for degrees, a float for minutes, and a char for the direction letter (N, S, E, or W). This class can hold either a latitude variable or a longitude variable. Write one member function to obtain an angle value (in degrees and minutes) and a direction from the user, and a second to display the angle value in 179°59.9’ E format. Also write a three-argument constructor. Write a main() program that displays an angle initialized with the constructor, and then, within a loop, allows the user to input any angle value, and then displays the value. You can use the hex character constant ‘\xF8’, which usually prints a degree (°) symbol.
inputString =input("");
sumDigits =0
numberDigits=0
# Looping through a string.
for character in inputString:
if (character.isdigit()):
# Calculate the sum of the digits of all numbers that appear in the string
sumDigits+=int(character)
numberDigits+=1
# Calculate the average of the digits of all numbers that appear in the string
average=sumDigits/numberDigits
# Print the sum of all digits(8)
print(str(sumDigits))
# Print the average of all digits(2.0) in the new line.
print("%.1f" % average)
input:
Anjali25 is python4 Expert
ouput:
11
3.7
the output should be like this:
11
3.67M, N = input().split(' ')
M, N = int(M), int(N)
matrix = []
for i in range(M):
row = [int(j) for j in input().split(' ')]
matrix.append(row)
values = [j for row in matrix for j in row]
values.sort()
output = matrix
for i in range(M):
for j in range(N):
output[i][j] = values[i * M + j]
for row in output:
print(*row)
input:
2 5
-50 20 3 25 -20
88 17 38 72 -10
output:-
50 -20 -10 3 17
-10 3 17 20 25
the output should be like this:-
50 -20 -10 3 17
20 25 38 72 88so can anyone please give correct code?
Given two polynomials A and B, write a program that adds the given two polynomials A and B.Input
If the add polynomials is euqal to zero it should print output:"0"
You are hired as network administrator for Holiday Din Crown Plaza Hotel.com.The Company has decided to locate a small branch office in Karachi city. To support the new location, you will need to subnet the IP address range. The departments at the new location will require the numbers of computers on their subnets. The new office location has been assigned the 192.0.0.0/24. Perform the sub-netting for the following network using Cisco Packet Tracer.
1. IT department has 10 hosts
2. Marketing & Advertising department has 35 hosts
3. Research and Logistics has 25 hosts
4. Sales department has 20 hosts
5. Administrative department has 30 hosts
6. Finance department has 15 hosts
All department relate to each other via WAN links, each WAN requires two IP addresses. Configure the network clock rate (speed) for serial ports, manually-configure routing entry, rather than information from a dynamic routing traffic
Prepare a structure to store information on cat info (name , age , type). Create an array structured variable named CatInfo to received 2 inputs from user.
Write a template function that returns the average of all the elements of an array. The arguments to the function should be the array name and the size of the array (type int). In main(), exercise the function with arrays of type int, long, double, and char
Prepare a structure to store information on cat info (name , age , type). Create an array structured variable named CatInfo to receive 2 inputs from user.
Write a function isPalindrom() that takes as input a C string and its size, and recursively tests whether it is a palindrome (a word or phrase which remains the same if reversed. e.g. radar, kayak etc). The function returns the Boolean data type which is either true or false. The required header “stdbool.h” has already been included in tasks.h.
The function has the following prototype:
bool isPalindrom(char * ptr_array, int size);
The recursive definition of a palindrome is:
• The string is a palindrome if it has only one character or is an empty string.
• The string is a palindrome if the first and the last characters are the same and the characters in between form a palindrome.