0

This is the code that I made:

number = input("What day number does your anime come out? ")
epi = input("How many episodes are there? ")

for epi in range(12):
  print(number)
  number + 7

the entire error message is:

Traceback (most recent call last):
  File "/Users/kevinforstner/anime release calc.py", line 6, in <module>
    number + 7
TypeError: can only concatenate str (not "int") to str
enzo
  • 9,861
  • 3
  • 15
  • 38
  • 1
    @NMme I really doubt OP will want to concatenate a string here. It's much more likely they want `number` to be a number and not a string and add 7 to it. Hard to say without OP clarifying this though. – Spencer Wieczorek Aug 18 '21 at 15:07
  • @SpencerWieczorek good point, I think it is most likely what OP wants – NMme Aug 18 '21 at 15:11

1 Answers1

3

In python, when you take input, it will be considered a string by default, so you'll need to parse the input as an integer, like this:

number = int(input("What day number does your anime come out? "))

Only then, number + 7 will be an addition of two integers, else it is considered that you're trying to append the integer 7 to the string number, and a TypeError will be raised.

Vikas B N
  • 31
  • 2