Write a program that asks the user to enter two integers, obtains the numbers from the user, then prints the larger number followed by the words "is larger." If the numbers are equal, print the message "These numbers are equal."
Write a function called Findoutput. The function takes a 4 digits integer as parameter validates the integer and returns 0 when the digits are in increasing order or 1 when the digits are in decreasing order or 99 when the digit are not in any order
The information about a song should include:
Artist name
Title
Length
Number of likes
The data members for SongList should be a head pointer to a linear linked list of Song objects and the number of songs in the list. The songs should be organized by popularities with the most popular song as the first node in the list.
This ADT must have public member functions to perform the following:
Constructor - Construct an object and initialize the data members
Destructor - Release all dynamic memory and reset data members to their zero equivalent value
Add a new song
Edit the number of likes for a song
Display all songs in the list
Display all songs for an artist (in order of popularity)
Remove all songs with fewer than M likes, where M is sent in as an argument
The test program needs to first load the test data set from external file at the beginning of the program.
1. Copy the countdown function from below.
def countdown(n):
if n <= 0:
print('Blastoff!')
else:
print(n)
countdown(n-1)
Write a new recursive function countup that expects a negative argument and counts “up” from that number. Output from running the function should look something like this:
>>> countup(-3)
-3
-2
-1
Blastoff!
Write a Python program that gets a number using keyboard input. (Remember to use input for Python 3 but raw_input for Python 2.)
If the number is positive, the program should call countdown. If the number is negative, the program should call countup. Choose for yourself which function to call (countdown or countup) for input of zero.
Provide the following.
Write a MATLAB program to solve the following integral using
Simpson’s 1/3rd Rule.
I=∫ p0 (ax3+bx2+cx+d) dx=?
Assign suitable values of a, b, c and d.
Also assume suitable values of p and step size h.
Compare your program result with original one.
Apply Trapezoidal Rule, Simpsons 1/3 Rule and Trapezoidal Rule to compute
a
I=∫ p/q+x^2
0
Assume: i) the constant “a”- in between 1.1 to 1.5
ii) the constant “p” – in between 2 to 5.
iii) the constant “q” – in between 6 to 9.
iv) the increment “h” – in between 0.025 to 0.1Let we have to prepare the final result of each student for a particular subject. The final
marks are sum of marks obtained by the student in T1, T2, T3, P1, P2, and attendance in theory class. Let
there are following classes: Grade ‘A’ for> 80% marks, ‘B’ for 70 to 80%, ‘C’ for 60 to 70%, D for 50 to 60%, F for <50%.Base on above information, do the following:
(i) Write a function which prints the name and grades of all students in the ascending order of the
grades. In case of same grade, print all respective names in alphabetical order.
(ii) Write a function which prints the name and grades of all students in the alphabetical order of
the name of the students.
(iii) Write a function to search the grade of a student based on the first name of the student. In
case of multiple entries with same name, print all the names with roll number and respective
grades.
Let we have to prepare the final result of each student for a particular subject. The final
marks are sum of marks obtained by the student in T1, T2, T3, P1, P2, and attendance in theory class. Let
there are following classes:(a) Student: Its data members are student name and roll number and member function is to print
the values of the data members.
(b) T1T2T3: Its data members are marks obtained by a student in T1, T2, and T3 and member
function is to print the values of the data members.
(c) P1P2: Its data members are marks obtained by a student in P1 and P2 and member function is
to print the values of the data members.
(d) Attendance: Data member of this class is the percentage of attendance of a student in the
theory class and member function is to print the values of the data member.
(e) Total: Data members of this class are total marks obtained and the grade secured by a student
and member function is to print the values of the data members.
1. Copy the countdown function from below.
def countdown(n):
if n <= 0:
print('Blastoff!')
else:
print(n)
countdown(n-1)
Write a new recursive function countup that expects a negative argument and counts “up” from that number. Output from running the function should look something like this:
>>> countup(-3)
-3
-2
-1
Blastoff!
Write a Python program that gets a number using keyboard input. (Remember to use input for Python 3 but raw_input for Python 2.)
If the number is positive, the program should call countdown. If the number is negative, the program should call countup. Choose for yourself which function to call (countdown or countup) for input of zero.
Provide the following.