#๐Ÿ”’ exercise on website ".join(a + b)"

47 messages ยท Page 1 of 1 (latest)

abstract lark
iron fogBOT
#

@abstract lark

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

abstract lark
#

i need to get Hello World as output but for some reason its adding spaces between the letters

#

and thats why i put a space in "here".join

unborn berry
#

hence, it prints out all the letters iwth a space in between

abstract lark
#

why is the .join method adding a space in between every letter then?

neat island
#

.join basically means "take every iterable element in this input, and put it together with the thing inbetween"

neat island
#

!e

print('TEST'.join("HelloWorld"))
iron fogBOT
abstract lark
#

a yes

#

how do i put a space in between a and b then

#

omg

#

space

neat island
#

(aka a list)

feral urchin
#

a + โ€œ โ€œ + b

abstract lark
#

u mean like

neat island
#

' '.join([a] + [b])

abstract lark
#

([a + b])

#

oh

neat island
amber spade
#

#1298729335032905790 Anyone can help me? (Srry)

neat island
#

that creates a list with a single element "HelloWorld"

unborn berry
#

there's a bunch of different ways,

  • a + " " + b
  • " ".join((a, b))
  • f"{a} {b}"
abstract lark
#

aa i see

neat island
amber spade
#

I dont know anything of python;(

neat island
#

wait for sm1 to help then

amber spade
#

Ok

neat island
#

dont beg in other channels

amber spade
#

Ok, sorry

neat island
#

[a, b] works

#

or [a] + [b]

abstract lark
#

yeye i understand

neat island
abstract lark
#

w

#

tyall

#

!close

iron fogBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

neat island
#

np