75 811
Anthropic is giving access to 6 months of free Claude Ultra for Opensource contributors.
Check the details and apply at: https://claude.com/contact-sales/claude-for-oss
🎖📖🎖
@aplusacademyy
04 12月, 11:10
🌟Hard work + Dedication pays off ᗩ+. 👉ለማስታወቂያ @Aplus_Gebeya 🎉 ADS: https://telega.io/c/aplusacademyy
显示更多频道 ᗩ+ አካዳሚ (@aplusacademyy) 阿姆哈拉语 语言赛道中的 是活跃参与者。目前社区聚集了 75 811 名订阅者,在 教育 类别中位列第 2 083,并在 埃塞俄比亚 地区排名第 444 位。
自 невідомо 创建以来,项目保持高速增长,吸引了 75 811 名订阅者。
根据 05 十二月, 2026 的最新数据,频道保持稳定运转。过去 30 天订阅人数变化为 -1 525,过去 24 小时变化为 -58,整体触达仍然可观。
作者将该频道定位为表达主观观点的平台:
“🌟Hard work + Dedication pays off ᗩ+.
👉ለማስታወቂያ @Aplus_Gebeya
🎉 ADS: https://telega.io/c/aplusacademyy”
凭借高频更新(最新数据采集于 06 十二月, 2026),频道始终保持新鲜度与高覆盖。分析显示受众积极互动,使其成为 教育 类别中的关键影响点。
for i in range(1, 6):
print(i)
Output:
1
2
3
4
5
3. What is a while loop?
A while loop repeatedly executes a block of code as long as the given condition remains true.
Example:
i = 1
while i <= 5:
print(i)
i += 1
4. What is the difference between for loop and while loop?
For Loop:
• Commonly used when iterating over a sequence.
• Useful when the number of iterations is known.
• Iteration is generally managed by the loop structure.
While Loop:
• Executes as long as a condition is true.
• Useful when the number of iterations is unknown.
• Requires careful condition updates to avoid infinite loops.
5. What is a nested loop?
A nested loop is a loop inside another loop.
for i in range(1, 4):
for j in range(1, 3):
print(i, j)
Output:
1 1
1 2
2 1
2 2
3 1
3 2
6. What is the break statement?
The
breakstatement is used to immediately terminate a loop when a particular condition is satisfied.
for i in range(1, 6):
if i == 3:
break
print(i)
Output:
1
2
7. What is the continue statement?
The
continuestatement skips the current iteration and moves to the next iteration of the loop.
for i in range(1, 6):
if i == 3:
continue
print(i)
Output:
1
2
4
5
8. What is the pass statement?
The
passstatement is a placeholder that performs no operation. It is useful when you want to create an empty block of code without getting a syntax error.
for i in range(1, 4):
if i == 2:
pass
print(i)
Output:
1
2
3
9. What is an infinite loop?
An infinite loop is a loop that continues executing because its termination condition is never reached.
while True:
print("Hello")
This loop continues until it is interrupted or terminated externally.
10. How do you find the sum of the first N natural numbers using a loop?
Example: Find the sum of numbers from 1 to 5.
n = 5
total = 0
for i in range(1, n + 1):
total += i
print(total)
Output:
15
Explanation:
1 + 2 + 3 + 4 + 5 = 15
✨ Share with your Friends
🎖📖🎖
@aplusacademyy
@aplusacademyyage = 20
if age >= 18:
print("Eligible to vote")
else:
print("Not eligible")
2. What is an if statement?
An if statement executes a block of code only when a specified condition is true.
number = 10
if number > 0:
print("Positive number")
Output:
Positive number
3. What is the difference between if, elif, and else?
• if: Checks the first condition.
• elif: Checks additional conditions if previous conditions are false.
• else: Executes when none of the conditions are true.
Example:
marks = 75
if marks >= 90:
print("Grade A")
elif marks >= 60:
print("Grade B")
else:
print("Grade C")
Output:
Grade B
4. What is a nested if statement?
A nested if statement is an if statement written inside another if statement.
age = 25
has_id = True
if age >= 18:
if has_id:
print("Entry allowed")
Output:
Entry allowed
5. What is the difference between if-else and switch statements?
If-Else:
• Used to check conditions and ranges.
• Supports complex logical expressions.
• Available in most programming languages.
Switch:
• Used to select one execution path based on a matching value.
• Often cleaner when comparing one expression against multiple fixed cases.
• Available in languages like Java, C, and C++.
Python does not have a traditional switch statement, but it provides match-case (Python 3.10+).
6. How do you check whether a number is even or odd?
A number is even if it is divisible by 2; otherwise, it is odd.
num = 15
if num % 2 == 0:
print("Even")
else:
print("Odd")
Output:
Odd
7. How do you find the largest of two numbers?
Use an if-else statement to compare both numbers.
a = 25
b = 40
if a > b:
print("A is largest")
else:
print("B is largest")
Output:
B is largest
8. How do you find the largest of three numbers?
Use multiple conditions to compare three numbers.
a = 10
b = 25
c = 15
if a >= b and a >= c:
print(a)
elif b >= a and b >= c:
print(b)
else:
print(c)
Output:
25
9. What is a ternary operator?
A ternary operator is a shorthand way of writing a simple if-else condition in a single line.
result = "Adult" if age >= 18 else "Minor"
print(result)
Output:
Adult
10. How do you check whether a year is a leap year?
A year is a leap year if:
• It is divisible by 400, OR
• It is divisible by 4 but not divisible by 100.
year = 2024
if (year % 400 == 0) or (year % 4 == 0 and year % 100 != 0):
print("Leap Year")
else:
print("Not a Leap Year")
Output:
Leap Year
✨ Share with your Friends
🎖📖🎖
@aplusacademyy
@aplusacademyyage = 25
age = 30
PI = 3.14159
Here,
agechanges, while
PIis conventionally treated as a constant. 2. What are primitive data types? Primitive data types are the basic types used to represent simple values. Common examples include: • Integer • Float • Character • Boolean The exact primitive types depend on the programming language. 3. What is the difference between Integer and Float? • Integer: Stores whole numbers without decimal points. • Float: Stores numbers with decimal points. Example:
age = 25
price = 99.99
4. What is Type Casting?
Type casting is the process of converting a value from one data type to another.
Example:
num = "100"
result = int(num)
print(result)
Output:
100
5. What is the difference between Implicit and Explicit Type Conversion?
• Implicit conversion: Automatically performed by the programming language.
• Explicit conversion: Manually performed by the programmer.
Example:
# Implicit
a = 10
b = 2.5
c = a + b
# Explicit
x = int(10.8)
6. What are Arithmetic Operators?
Arithmetic operators are used to perform mathematical operations.
+----------+----------------+ | Operator | Operation | +----------+----------------+ | `+` | Addition | | `-` | Subtraction | | `*` | Multiplication | | `/` | Division | | `%` | Modulus | | `//` | Floor division | | `**` | Exponentiation | +----------+----------------+7. What is the difference between
=and
==? •
=is an assignment operator used to assign a value. •
==is a comparison operator used to check whether two values are equal. Example:
x = 10
print(x == 10)
Output:
True
8. What are Logical Operators?
Logical operators are used to combine or modify conditional expressions.
Three common logical operators:
• AND – True if both conditions are true.
• OR – True if at least one condition is true.
• NOT – Reverses the Boolean result.
Example:
age = 25
print(age > 18 and age < 60)
Output:
True
9. What is the Modulus Operator (
%)? The modulus operator returns the remainder after division. Example:
print(10 % 3)
Output:
1
It is commonly used to check whether a number is even or odd.
10. How do you swap two variables without using a third variable?
In Python, you can use tuple unpacking.
a = 10
b = 20
a, b = b, a
print(a, b)
Output:
20 10
Double Tap ❤️ For Part-3
✨ Share with your Friends
🎖📖🎖
@aplusacademyy
@aplusacademyy
我们使用 cookie 来改善您的浏览体验。
点击“全部接受”,即表示您同意Cookie 使用政策。