Which is the following is the correct format for: sum = sum*2? A. sum=*2
B. sum*2
C. sum*=2
D. sum*2=sum
2. Please construct a class in terms of the below description. (5 marks)
HKIT needs to develop a system to keep the students’ profile including the name, student id, the programme enrolled by the student, address of student and age. Student could read and modify his/her profile. Please help construct a Student class for this purpose.
class Student {
//variables (2 marks)
//getter (one getter is ok) (1 mark)
//setter (one setter is ok) (2 mark)
Write if-else statement that outputs
Student must achieve at least 40 in the exam grade and 70% in the attendance in order to pass the module (print out “You pass the module!”). If the student fails the attendance only, the student needs to take classes to make up the attendance (print out ”Please take classes to make up your attendance.”) . If the student fails the exam grade only, the student is eligible to apply re-exam (print out “You are eligible for re-exam”). If the student fails both the exam and the attendance, the student needs to retake the whole module (print out Please retake the module”).
The variables attendance is of type double, and grade is of type int.
if (______________________ ) {
_______________________________________________________
}
elseif (___________________) {
______________________________________________________
}
elseif (___________________) {
______________________________________________________
}
else {
______________________________________________________
}
by CodeChum Admin
We've already done looping through a series of numbers and printing out its squares, so how about we level it up and go with cubes this time?
I have a condition though; I don't want to be associated with numbers that are divisible by 3 or 5 so if an integer is divisible by either of the two, don't make their cube values appear on the screen, please.
Care to fulfill my request?
Instructions
Output
Multiple lines containing an integer.
1
8
64
343
512
.
.
.by CodeChum Admin
Let's now try finding a certain digit into an integer! Come and join in on the fun and code with me!
Instructions
by CodeChum Admin
We've already counted digits before on a certain number, so how about doing it on strings and characters? There's a catch, though, since you're only going to count and see if the character exists at least twice in a string.
Are you up for the challenge?
Instructions
Describe the difference between objects and values using the terms “equivalent” and “identical”. Illustrate the difference using your own examples with Python lists and the “is” operator.
Describe the relationship between objects, references, and aliasing. Again, create your own examples with Python lists.
Finally, create your own example of a function that modifies a list passed in as an argument. Describe what your function does in terms of arguments, parameters, objects, and references.
Create your own unique examples for this assignment. Do not copy them from the textbook or any other source.
Program 3:
Write a program which inputs integers to the user, which puts them as and when
measure in a list (List container of the STL), which sorts this list and then displays the
sorted list.Logos Section
In this assignment, let's build a Logos Section by applying the concepts we learned till now.
Refer to the below images.
The following images illustrate all device sizes, from extra small to extra large.
Extra Small (Size < 576px) and Small (Size >= 576px):
Medium (Size >= 768px), Large (Size >= 992px) and Extra Large (Size >= 1200px):
print the sum of an array and the array 1-d