0% found this document useful (0 votes)
2 views

Python Arithmetic Coding Questions

The document contains a list of 50 Python practice questions focused on variables and arithmetic operations. Each question requires writing code to perform specific calculations or manipulations with given variables. The questions cover a range of topics including basic arithmetic, average calculations, and simple interest, among others.

Uploaded by

giigdyerug
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python Arithmetic Coding Questions

The document contains a list of 50 Python practice questions focused on variables and arithmetic operations. Each question requires writing code to perform specific calculations or manipulations with given variables. The questions cover a range of topics including basic arithmetic, average calculations, and simple interest, among others.

Uploaded by

giigdyerug
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Variable & Arithmetic Practice Questions

1. Write a program that initializes `a = 5`, `b = 10`, then increases `a` by 2 and prints `a + b`.

2. Set `x = 15`, `y = 7`. Decrease `y` by 3 and print `x - y`.

3. Assign `m = 4`, `n = 2`. Multiply both by 2 and print the product of `m` and `n`.

4. Write code to add 5 to a variable `a = 20` and subtract 3 from `b = 8`, then print `a - b`.

5. Start with `a = 100`, `b = 50`. Divide `a` by 2, then print `a // b`.

6. Take `x = 3`, `y = 4`. Raise `x` to the power of `y` and print the result.

7. Assign `a = 10`, then do `a += 10`, then `a -= 5`. Print the final value.

8. Given `p = 7`, `q = 3`, calculate and print the remainder of `p % q`.

9. Write a program to swap two numbers `a = 5` and `b = 10`, then print their values.

10. Set `x = 9`, `y = 6`, then increase both by 3. Print `x * y`.

11. Initialize `a = 1`. Do `a = a + 2`, `a = a * 3`, and print `a`.

12. Given `m = 25`, `n = 5`, print the value of `m / n` and `m // n`.

13. Assign `a = 14`, `b = 6`, then find the average of `a` and `b`.

14. Input any two numbers and print their sum.

15. Set `a = 50`, then perform `a %= 9` and print the result.

16. Assign `x = 3.5`, `y = 1.2`, add them and print the sum.

17. Calculate the square of a number `a = 6` using multiplication.

18. Write a program to increase `a = 2` five times using `a += 1` in each step and print `a`.

19. Given `x = 8`, decrement it by 1 and multiply the result by 3. Print it.

20. Assign `a = 100`, subtract 40 and then divide the result by 2. Show the result.

21. If `p = 3`, `q = 5`, perform and print `(p + q) * (p - q)`.

22. Set `a = 13`, `b = 4`. Print the result of `a**b`.

23. Assign `x = 12.5`, `y = 2.5`, and calculate `x/y`.

24. Create a variable `temp = 30`, convert it to Fahrenheit using `F = (temp * 9/5) + 32`.

25. Write a program to find the cube of a number using exponentiation.

Page 1
Python Variable & Arithmetic Practice Questions

26. If `a = 11`, `b = 3`, find the floor division and modulus.

27. Given `total = 500`, `count = 8`, find the average.

28. Set `a = 9`, increase by 10%, then print the new value.

29. Set `price = 100`, apply 18% GST, print final amount.

30. If `a = 25`, subtract 5, multiply the result by 4, and add 2. Print the final output.

31. Write a program to calculate `simple interest = (P*T*R)/100` where `P=1000, T=2, R=5`.

32. Given `a = 7`, `b = 4`, calculate `a^2 + b^2`.

33. Take two variables and print whether their sum is even or odd.

34. Assign `num = 153`, break it into digits and print their sum.

35. Write a program to reverse a 3-digit number.

36. Set `x = 20`, `y = 3`, perform all five basic operations and print results.

37. Given a number `a = 10`, increment it without using `+` operator.

38. Write a program that multiplies two numbers and subtracts a third number.

39. Create a variable `radius = 7`, find the area of a circle.

40. Assign `a = 20`, `b = 7`, `c = 3`, then print `a + b * c`.

41. If `length = 10`, `breadth = 5`, calculate the perimeter of the rectangle.

42. Assign `base = 6`, `height = 4`, calculate the area of triangle.

43. Write a program to find the average of three given numbers.

44. Given `a = 3`, `b = 5`, `c = 7`, compute `a * b + c`.

45. Assign `a = 8`, use only `*` operator to find the square.

46. Create a program to compute `volume = length * breadth * height` with inputs.

47. Write a program to calculate BMI using `BMI = weight/(height*height)` with dummy values.

48. Given `n = 37`, check if it's divisible by 3 and print result.

49. Calculate the percentage marks out of 500 marks.

50. If `a = 15`, `b = 4`, print both `(a/b)` and `(a//b)`.

Page 2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy