Category "string"

The most common letter in a string (Python)

I have an exercise to find the most common letter in a string, excluding punctuation symbols, digits and whitespaces and the result should be in lowercase "A"==

Nested if statement is only executing first part

What I want my code to do I want my code to validate user input without using Regex or isDigit operators. If all the requirements of the if statements are found

Printing string range in Python

s ="XII" roman = {"I":1, "IV":4, "V":5, "IX":9, "X":10, "XL":40, "L":50, "XC":90, "C":100, "CD":400, "D":500, "CM":900, "M":1000} out = 0 n =

How do I force a blank for rows in a dataframe that have any str or character apart from numerics?

I have a datframe >temp Age Rank PhoneNumber State City 10 1 99-22344-1 Ga abc 15 12 No Ma xyz For the column(Phone Numbe

How can I truncate a line of text longer than a given length?

How would you go about removing everything after x number of characters? For example, cut everything after 15 characters and add ... to it. This is an example s

R incongruity when copying a column in R with ifelse

After loading lots of xlsx sheets of multiple workbooks, I want to create a double check of the tidiness and cleanliness of the data source. I created a data fr

PostgreSQL Can't Convert String to double precision

So I'm asked to do this query for a college project: SELECT l.city AS name, AVG((pr.ap_price::double precision * 7 - pr.weekly::doub

Python sum of values in dataset

I have this dataframe (ID is a string and Value a float): ID Value 1 0.0 1.1 0.0 1.2 0.0 1.2.1 2750

Is it safe to store dates as a string in mysql?

I have to allow my users to make an update with 24 hours of delay from their previous update, so because date operations in this case are going to be on the bac

about replace methods in string in js

let code = document.querySelector('.Nform').innerHTML; localStorage.setItem('code',JSON.stringify(code)); let finalCode = code.replace(/ <p class="removeElem

Print data from Class instance

I want to print out data from a Class instance. I tried including data in str function, but this only works when value is at its default (an empty list). After

i have an assignment that works in compiler but does not work properly in assignment website

I have a homework that requires me to do operations on a string, I used an iterator in the second function to find the last index of a letter in the string and

How can I use backslashes (\) in a string?

I tried many ways to get a single backslash from an executed (I don't mean an input from html). I can get special characters as tab, new line and many others

Python fuzzy matches of elements from two lists of song titles

I have two lists of titles for jazz standards. Both lists have a couple thousand entries, and I would like to find the songs in the second list that are not co

Python fuzzy matches of elements from two lists of song titles

I have two lists of titles for jazz standards. Both lists have a couple thousand entries, and I would like to find the songs in the second list that are not co

Longest Common Prefix in Javascript

I am trying to solve the Leet Code challenge 14. Longest Common Prefix: Write a function to find the longest common prefix string amongst an array of strings.

Python FTP return corrupted name of file: じし->し ゙し (how can i properly decode/encode a string)

In my open source application, I use rented hosting with FTP. My application needs to read a list of files from a directory and parse it. However, some of the f

UITextView - limit amount of characters per line

I have a UITextView and I want to line break each time a user is extending a limit of chars per line (let's say 30 chars per line is the maximum). And I want to

Why does my string not match when reading user input from stdin?

I'm trying to get user input and check if the user put in "y" or "n". Surprisingly, in the below code, neither the if nor the if else case executes! Apparently,

Python: find the start index of a specific word number in a string

I have this string: myString = "Tomorrow will be very very rainy" I would like to get the start index of the word number 5 (very). What I do currently, I do sp