0

Greetings all please I want to ask something

What's the meaning of this signs in python [ are this one same with parentheses ; < class > : == Ist1,Ist2 ** eg 3*1**3 means What's the difference between// and /

26th Feb 2024, 11:05 AM
🔹️🔹️Judy🔹️🔹️
🔹️🔹️Judy🔹️🔹️ - avatar
6 Respostas
+ 1
Absolutely, I understand that my previous response might have been a bit advanced. Consider it as a starting point or a nudge in the right direction. Each symbol and concept I mentioned plays a unique role in Python, and understanding them will become easier as you progress in your course. In the meantime, feel free to explore these concepts at your own pace. Searching online or utilizing resources like Python documentation can be incredibly helpful. Remember, curiosity and patience are key in learning programming. You’ll encounter these symbols and their applications naturally as you continue your studies.
26th Feb 2024, 2:18 PM
Per Bratthammar
Per Bratthammar - avatar
+ 2
In Python: • [] denotes a list or index operation. For example, [10, 20, 30][1] returns 20. • ; is used to separate multiple statements on a single line. For instance, len([1, 2, 3]); print("hello") outputs 3 and hello. (not recommended) • <class 'type'> indicates the type of a class. For example, defining class MyClass: pass and then using type(MyClass) returns <class 'type'>. • : is used to separate the header of a compound statement from its body. Example: if condition: action() executes action() if condition is true. • == compares two values for equality. a == b returns True if a and b are equal, otherwise False. • (item1, item2) creates a tuple, which is an immutable sequence. For example, lst1, lst2 implies a tuple containing lst1 and lst2. Differences between // and /: • / is used for division, returning a float. • // is the floor division operator, returning the largest possible integer that is less than or equal to the algebraic quotient.
26th Feb 2024, 12:18 PM
Per Bratthammar
Per Bratthammar - avatar
+ 2
Per Bratthammar , One tweak. Floor division // returns float if either operand is float, and it rounds toward negative infinity. print(5 // 2) # 2 print(5.0 // 2) # 2.0 print(-5 // 2) # -3
26th Feb 2024, 3:20 PM
Rain
Rain - avatar
+ 1
Thanks you sir😊😊
26th Feb 2024, 2:22 PM
🔹️🔹️Judy🔹️🔹️
🔹️🔹️Judy🔹️🔹️ - avatar
+ 1
Hi, Rain ! Thanks for the tweak! You’re right, // does return a float if any operand is a float, rounding toward negative infinity—a subtle but important point. Similarly, % with floats keeps the precision, reflecting Python’s consistency in handling numeric operations. It’s these nuances that make Python both interesting and challenging. Appreciate the insight!
26th Feb 2024, 5:16 PM
Per Bratthammar
Per Bratthammar - avatar
0
Thank you Mr Per Bratthammar Am still in coding foundation and your answer is difficult for me to understand can you please break it down in a beginner level
26th Feb 2024, 12:41 PM
🔹️🔹️Judy🔹️🔹️
🔹️🔹️Judy🔹️🔹️ - avatar