Find an Online Tutor Now

32 Answered Questions for the topic String

String Physics Forces

08/02/19

Understanding tension?

I'm trying to understand tension. So here it goes: I'll start from the beginning. Let's assume I'm in space and can move around and apply forces. Let's say a rope is attached to a body(which is... more
String Physics Forces

07/30/19

When is tension constant in a rope?

Suppose we have a massless rope with pulling forces applied at each end. In which scenarios is the tension in the rope constant throughout? For example if there is a knot in the rope the tension is... more
String Physics Forces

07/30/19

Rope tension question?

If two ends of a rope are pulled with forces of equal magnitude and opposite direction, the tension at the center of the rope must be zero. True or false? The answer is false. I chose true though... more

07/27/19

Generate random numeric & alphabetic?

I'm making a random hexadecimal generator is it possible in visual basic to make a code that randomly generates number and letters together? How would you do it? I'm really lost. I'd like to... more

07/27/19

Choose For Random Strings In Commodore 64 BASIC?

I have this variable declarations on my program: X="MAGENTA" Y="CYAN" Z="TAN" A="KHAKI" Now what I want is to randomly choose one of these and `PRINT` it. But how to do this?
String Physics Forces

07/17/19

How could a cord withstand a force greater than its breaking strength?

How could a 100 N object be lowered from a roof using a cord with a breaking strength of 80 N without breaking the cord? My attempt to answer this question is that we could use a counter weight.... more
String Python List

06/14/19

Python join: why is it string.join(list) instead of list.join(string)?

This has always confused me. It seems like this would be nicer: my_list = ["Hello", "world"] print my_list.join("-") # Produce: "Hello-world"Than this: my_list = ["Hello", "world"] ... more

06/13/19

Safe integer parsing in Ruby?

I have a string, say `'123'`, and I want to convert it to `123`.I know you can simply do `some_string.to_i`, but that converts `'lolipops'` to `0`, which is not the effect I have in mind. I want it... more

06/08/19

Why does comparing strings using either '==' or 'is' sometimes produce a different result?

I've got a Python program where two variables are set to the value `'public'`. In a conditional expression I have the comparison `var1 is var2` which fails, but if I change it to `var1 == var2` it... more
String Ruby

05/30/19

How to check whether a string contains a substring in Ruby?

I have a string variable with content as follows: varMessage = "hi/thsid/sdfhsjdf/dfjsd/sdjfsdn\ " "/my/name/is/balaji.so\ " ... more
String Logic Php

05/29/19

How to parse a string of boolean logic in PHP?

I'm building a PHP class with a private member function that returns a string value such as: 'true && true || false' to a public member function. (This string is the result of some regex... more

05/22/19

Most elegant way to check if the string is empty in Python?

Does Python have something like an empty string variable where you can do: if myString == string.empty:Regardless, what's the most elegant way to check for empty string values? I find hard... more
String Python Count

05/12/19

Count the number occurrences of a character in a string?

What's the simplest way to count the number of occurrences of a character in a string?e.g. count the number of times `'a'` appears in `'Mary had a little lamb'`
String Python Unicode

04/30/19

How to lowercase a string in Python?

Is there a way to convert a string from uppercase, or even part uppercase to lowercase? E.g. Kilometers --> kilometers.
String Ruby Arrays

04/29/19

How to split a delimited string in Ruby and convert it to an array?

I have a string `"1,2,3,4"` and I'd like to convert it into an array: [1,2,3,4]How?
String Ruby

04/28/19

Ruby capitalize every word first letter?

I need to make the first character of every word uppercase, and make the rest lowercase... manufacturer.MFA_BRAND.first.upcaseis only setting the first letter uppercase, but I need this: ALFA... more

04/23/19

Why does "Conversion from string "ID" to type integer is not valid" show on my program?

I'm trying to display my database on textboxes, with the help of the combobox for the ID. However, whenever I run my program, the error **"Conversion from string "ID" to type integer is not... more
String Python

04/07/19

Is there a way to substring a string?

Is there a way to substring a string in Python, to get a new string from the 3rd character to the end of the string?Maybe like `myString[2:end]`?If leaving the second part means 'till the end', if... more
String Python File

04/04/19

How to read a file line-by-line into a list?

How do I read every line of a file in Python and store each line as an element in a list? I want to read the file line by line and append each line to the end of the list.

04/03/19

Convert bytes to a string?

I'm using this code to get standard output from an external program: >>> from subprocess import * >>> command_stdout = Popen(['ls', '-l'], stdout=PIPE).communicate()[0]The... more
String Python Trim

04/01/19

How do I trim whitespace?

Is there a Python function that will trim whitespace (spaces and tabs) from a string?Example: `\  example string\ ` → `example string`
String Python Trim

03/26/19

How do I trim whitespace from a Python string?

How do I remove leading and trailing whitespace from a string in Python?For example: " Hello " --> "Hello" " Hello" --> "Hello" "Hello " --> "Hello" "Bob has a cat" -->... more
String Python Format

03/26/19

How can I print literal curly-brace characters in python string and also use .format on it?

x = " \\{ Hello \\} {0} " print x.format(42) gives me : `Key Error: Hello\\\\`I want to print the output: `{Hello} 42`
1

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.