Write a program that accepts student mark out of 100, and return the corresponding letter grade based on the following condition:
if mark is greater than or equal to 90 A
if mark is greater than or equal to 80 and less than 90B
if mark is greater than or equal to 60 and less than 80C
if mark is greater than or equal to 40 and less than 60D
if mark is less than 40F
for other cases NG
N.B write the program using both switch and if-else if- else Statements.
It is known that a score for a given course is b/n 0-100
Write a program that gives the maximum value from an array with size 8. The data stored in the array should be accepted from the user and should be an integer value. Write another program which orders the same data in an ascending order
1 Write a program which inputs a person’s height (in centimetres) and weight (in kilograms) and outputs one of the messages: underweight, normal, or overweight, using the criteria:
Underweight: weight < height/2.5
Normal: height/2.5 <= weight <= height/2.3
Overweight: height/2.3 < weight
Create a method named getCircleDiameter that takes a radius of double type as the parameter. The method should return the diameter of a circle. To compute the diameter of a circle, multiply the radius by 2.
Create a class named Account with an instance variable named account_number. Make this class a member of the Accounts namespace.
Create a Python script that will display the next 5 numbers in the sequence where each number is the sum of the previous two.
TEXT FILE
8 3
4 5
6 2
Output
8 3 11 14 25 39 64
4 5 9 14 23 37 50
6 2 8 10 18 28 46
Python Problem Solving
You're given a positive integer: Perform the sequence of operations as per below guidelines until the value reaches 1:
If N is even --> N / 2
If N is odd --> N * 3 + 1
Print the total number of steps it took to reach 1.
Input
The first line of input contains an integer.
Output
The output should be a single integer denoting the total number of steps.
Explanation
For Example, using N = 10 as the input, with 6 steps.
10 is even - 10/2 = 5
5 is odd - 5 * 3 + 1 = 16
16 is even - 16 / 2 = 8
8 is even - 8 /2 = 4
4 is even - 4/2 = 2
2 is even - 2/2 = 1 --> Reached 1.
So the output should be 6.
Sample Input1
10
Sample Output1
6
Sample Input2
345
Sample Output2
125
Python Program
Write a python program to print the following output.
Input
The first line contains a string S representing a unique id.
The second line contains an integer N representing group length.
Output
The output should be a single string representing the new unique id.
Sample Input1
2-4A0r7-4k
3
Sample Output1
24-A0R-74K
Python Program
Write a program to print the following, Given a word W and pattern P, you need to check whether the pattern matches the given word.The word will only contain letters(can be Uppercase and Lowercase). The pattern can contain letters, ? and *.
? : Can be matched with any single letter.
* : Can be matched with any sequence of letters (including an empty sequence).
If the pattern matches with the given word, print True else False.
Sample Input1
3
Hello *l?
Hell He?ll
Hell ?*
Sample Output1
True
False
True
Sample Input1
3
Hello Hell*
Hell He*ll
Hell hell*
Sample Output1
True
True
False
Write a program to print the following output.
Input
The first line contains a string.
The second line contains some space-separated strings.
Output
The output should be a single integer.
Explanation
scramble word = "tacren"
guessed words = ["trance", "recant"]
Since "trance" and "recant" both have length 6 then you score 54 pts each.
So the output is 108.
Sample Input1
rceast
cat create sat
Sample Output1
2
Sample Input2
tacren
trance recant
Sample Output2
108