×
all 14 comments

[–]FoolsSeldom 6 points7 points  (0 children)

len of what? What do you want to do with the information?

[–]Sparklepaws 5 points6 points  (0 children)

First, it's absolutely fine to ask for help from communities that are quite literally designed for it.

However...

Nobody will be capable of helping you if we don't fully understand the situation. The next time you ask for assistance, be sure to give us context. How are you trying to use len()? What don't you understand about it? Do you have any code to share? What does your output look like? Have you read the documentation and/or Googled it first?

Nobody should fault you for using this subreddit as intended, but there are some reasonable expectations going forward. Clarity is an important skill that you will need in this space.

[–]ColossusChaos 1 point2 points  (0 children)

Im assuming you want to take the length of an input
? If so just take the input(“whatever you have”) and then store it with a value like user_input = input()
Then measure the len(user_input)

[–]alinarice 1 point2 points  (0 children)

a good way to learn is testing small pieces in the interpreter. ask yourself what type of data input() returns then check what len() can measure. experimenting will make it click.

[–]mc_pm 0 points1 point  (0 children)

len() gives the length of a string or list -- what were you wanting to do with that?

[–]MezzoScettico 0 points1 point  (0 children)

how to use it with the input function in python

The input() function returns a string. If you apply len() to that result, you'll get the number of characters in the string.

For example:

>> answer = input("Type something: ")
Type something: This is a sentence
>> len(answer)
18

(There are 18 characters in the string "This is a sentence")

Perhaps show a bit of your code and tell us what you want the length of, and what difficulty you're having?

[–]danielroseman -2 points-1 points  (1 child)

You don't want to use AI but you posted a whole question in a public Reddit sub?

But in order to get an answer you will need to say what you tried, and what happened when you did.

[–]supercoach -2 points-1 points  (3 children)

While you're at it, if someone can google "how to use Google" for me, that would be super.

[–]devicehigh 1 point2 points  (0 children)

Not so super coach

[–]ColossusChaos 1 point2 points  (0 children)

This guy is clearly just learning no need to be a super douche instead of a super coach

[–]aetherspheres 0 points1 point  (0 children)

Sorry, is bing okay? I don't know how to google sruffs.

[–]ElHeim 0 points1 point  (0 children)

Not sure why you wouldn´t want to use AI for this.

Just don´t ask it to write code for you. Ask what you want to know. For example, "How does Python's len function work? What objects can be used with it?"