Incrementing

Incrementing is when you increase the value of a variable by some amount. Here's code from a previous section that increments a variable:
count = 0
command = ""
while command != "quit":
  command = input("Enter a command: ")
  count = count + 1
  print(f"Loop has repeated {count} times.")
The variable count is initialized to 0, and increases by 1 on each iteration of the loop. Incrementing is not restricted to increasing by 1, but can be done with any arbitrary math expression. Example:
count = count * -5 / 2 - 1

Exercise 1 of 6

Write a line of code to increment the variable x by 1.

Your code

Exercise 2 of 6

Write a line of code to increment the variable x by 2.

Your code

Exercise 3 of 6

Write a line of code to increment the variable x by -1.

Your code

Exercise 4 of 6

Write a line of code to increment the variable x by a factor of 10.

Your code

Exercise 5 of 6

Write a line of code to increment the variable x by a factor of 1/3.

Your code

Exercise 6 of 6

Write code to increment the variable x by 1 a total of 10 times. Use a loop.

Your code