Professional Documents
Culture Documents
Document 12
Document 12
Document 12
1.Checks whether a given number is positive or negative. If the given number is positive then it will
print “Positive”. Displays “Negative” if it is negative and displays “Zero” if it is zero;
Algorithm
Step 1: Start
else:
print("It is zero.")
Step 4: Stop
2. asks a number from the user and generates an integer between 1 and 7 and displays the name of the
weekday.
Algorithm
Step 1: Start
Step 3: if num == 1:
elif num == 2:
print("Weekday is Tuesday")
elif num == 3:
print("Weekday is Wednesday")
elif num == 4:
print("Weekday is Thirsday")
elif num == 5:
print("Weekday is Friday")
elif num == 6:
print("Weekday is Saturday")
elif num == 7:
print("Weekday is Sunday")
else:
if num > 7:
print("Unknown Weekday!")
Step 4: Stop
3. checks whether a given number is even or odd. If the given number is even then it will print "Even
number".Prints "Odd number" if the given number is odd. Otherwise, it will print "Zero" if the given
number is zero.
3. Step 1: Start
print(f'Even number')
print(f'Odd number')
else:
print("Zero")
Step 5: Stop
4. finds whether a given year is a leap year or not. If the given year is leap year, then it will print "Leap
year".
Step 1: Start
Print(‘Leap year’)
Else:
Step 4: Stop
5. determines whether a given number is divisible by 3 or 5; If the given number is divisible by 3 or 5
then it will print "Divisible by 3 or 5". Prints "Not divisible by 3 or 5" otherwise;
Step 1: Start
else:
Step 4: Stop
6. accepts three numbers from the user and prints "Increasing order" if the numbers are in increasing
order, "Decreasing order"
if the numbers are in decreasing order, and "Neither increasing or decreasing order" otherwise;
Step 1: Start
Step 2:Input a, b ,c
Print(‘Increasing order’)
Print(‘Decreasing order’)
Else:
Step 4: Stop
7. checks whether a triangle is Scalene, Isosceles, or Equilateral;
Step 1. Start
Else:
Step 4. Stop
8. reads two numbers and displays these numbers in increasing order. If these numbers are equal, then
it will print "They are equal";
Step 1. Start
Step 2. Input a, b
List1.sort()
Step 5. Stop
9. accepts three numbers and determines the largest number;
Step 1. Start
Step 2. Input a, b, c
Remark is “Failed”. If final grade is 75 to 79 then remark is “Retake”. Otherwise, the remark is “Passed”
if final grade is 80 and above;
Step 1. Start
Print(“Remark: Failed”)
Print(“Remark: Retake”)
Else:
Print(‘Remark: Passed’)
Step 6. Stop
Step 1. Start
Step 3. Total = 0
a. Total += i
b. I += 1
Step 7. Stop
2. Prints the cube of all the numbers between LOW to HIGH; (print the result in comma-separated
style)
Step 1. Start
a. Print I * I * i
c. I += 1
Step 5. Stop
3. prints all numbers that are not divisible by 5 between HIGH down to LOW; (print the result in comma-
separated style)
Step 1. Start
If I % 5 != 0:
Print(I, end=”,”)
Step 4: Stop
4. prints all numbers from LOW to HIGH that are divisible by 3 or 4; (print the result in comma-separated
style)
Step 1. Start
Step 3. I = low
Step 6. if I % 3 == 0 or I % 4 == 0
Step 1. Start
Step 3. I = low
Step 6. if I % 2 == 0 and I % 3 == 0
Step 1. Start
If I % number == 0:
Print(I, end=”,”)
Step 4. Stop
7. prints all odd numbers between HIGH down to LOW; (print the result in comma-separated style)
Step 1. Start
If I % 2 != 0:
Print(I, end=’,’)
Step 4. Stop
8. prints all even from LOW to HIGH; (print the result in comma-separated style)
Step 1. Start
If I % 2 == 0:
Print(I, end=”,”)
Step 4.Stop
9. prints all numbers between LOW to HIGH by steps of STEP; (print the result in comma-separated
style)
Step 1. Start
Print(I, end=”,”)
Step 4. Stop
10. prints all numbers between HIGH down to LOW by steps of STEP. (print the result in comma-
separated style)
Step 1. Start
Print(I, end=”,”)
Step 4. Stop