Python 50 Programs - Assignment Operators
1. Assign a number to a variable and print it.
2. Assign the result of an arithmetic expression to a variable.
3. Assign string to a variable and print it.
4. Assign a list to a variable and access its elements.
5. Assign values to multiple variables in one line.
6. Add 5 to a variable using '+='.
7. Use '+=' inside a loop to calculate sum of first 10 natural numbers.
8. Concatenate strings using '+='.
9. Use '+=' with a float value.
10. Use '+=' to update list index value.
11. Subtract 3 from a variable using '-='.
12. Use '-=' inside a loop to count down from 10.
13. Use '-=' in a function to reduce value.
14. Subtract float using '-='.
15. Use '-=' in list value update.
16. Multiply a variable by 2 using '*='.
17. Use '*=' to calculate power of 2.
18. Use '*=' with string to repeat characters.
19. Use '*=' with float value.
20. Use '*=' inside a loop for factorial.
21. Divide a variable by 2 using '/='.
22. Use '/=' with float result.
23. Demonstrate floating-point division using '/='.
24. Chain '/=' with other operators.
25. Use '/=' in function return.
26. Perform floor division using '//='.
27. Use '//=' on negative values.
28. Use '//=' in a loop to reduce value till zero.
29. Apply '//=' on float and integer.
30. Use '//=' in rounding logic.
31. Use '%=' to get remainder of division.
32. Use '%=' in looping logic (e.g., wrap-around).
33. Combine '%=' with conditional check.
34. Apply '%=' on float.
35. Use '%=' to cycle through list indices.
36. Use '**=' to raise to power 2.
37. Use '**=' to generate exponential growth.
38. Apply '**=' in scientific calculation.
39. Use '**=' with float base.
40. Combine '**=' in loop to simulate power series.
41. Mix '+=', '-=', '*=' in a program.
42. Create a calculator using assignment operators.
43. Use assignment operators in class methods.
44. Use all assignment operators on same variable.
45. Use in temperature conversion formulas.
46. Update coordinates in a game using assignment operators.
47. Simulate bank account balance with '+=', '-='.
48. Physics formula (velocity, distance) using assignment operators.
49. Track inventory count using assignment operators.
50. Convert hours to minutes and seconds using '*=', '+='.