0

it puts out invalid syntax but I defined x so I don't really know what I'm doing wrong

I have tried putting x as an int and float. because it has to be a number otherwise it won't work

x=input("adja meg az x magasságát, szélességét egy szám ként")
szokoz=" "
slash="/"
backslash="\\"
print(slash x*szokoz backslash)

invalid syntax

hetot he
  • 13
  • 2

1 Answers1

2

You don't concatenate strings simply by putting them next to each other, you need to use the concatenation operator (you can put string literals next to each other, but that's just part of the literal syntax).

Also, if you're using Python 3, input() returns a string, not a number, you need to convert it to an integer.

x=int(input("adja meg az x magasságát, szélességét egy szám ként"))
szokoz=" "
slash="/"
backslash="\\"
print(slash + x*szokoz + backslash)
Barmar
  • 741,623
  • 53
  • 500
  • 612