How do I convert a String in MIPS to either upper or lower case?
So I am trying to optimize my MIPS code. Right now my code works by counting the number of upper case letters and then lower case letters and finally adds the total occurrences.
Since I have to go through double the loops to find the occurrences. I really want to change my string to either upper or lower case first so I do not have to go through the loop twice the times.
.datastr: .asciiz "Covert this to lower"
.text//loads the string here and//goes through the loops
I need to translate the address:
www.example.com/TEST in ---> www.example.com/test
I am trying to create a simple passwprd application and I want to check if my password meets some requierments. I want it to have both an uppercase letter and a digit somewhere. I am storing each letter of the password in a list using a for loop and I then check if each element in the list is uppercase. But when I, in the if statement that checks if the letter is uppercase, add a new if statemnt checking if one of the characters is a digit the if statement doesn’t return anything.
def check_password(): characters =  if len(password_entry.get()) >= 8: for i in range (len(password_entry.get())): characters.append(password_entry.get()[i]) if characters[i].isupper(): if characters[i].isdigit(): register_user() print("password valid") else: password_not_valid_upper() else: password_not_valid_length()
This question already has an answer here:
I am trying to create a simple password application using tkinter.I have an entry for the password when you sign up and I want to check if the password contains at least 1 uppercase letter for it to be valid.
How do I ”check” each character in the string to see if it’s uppercase or not?
I have a list strings that look like this:
strings = ["abc", "a", "AA", "DAabcas", "adesAA", "EFSFDAAAaaa"]
I also have an already existing function that goes through every element in the list and returns the number of capital letters in each string element:
capitals = 0for i in s: if i.isupper(): capitals += 1return capitals
"s" is each item in strings.
How can i use this to return the list strings sorted descending with the string with the most capital letters first, and the shortest word with the least or none capital letters?
Here is the result i want:
strings = ["EFSFDAAAaaa","DAabcas","adesAA", "AA", "abc", "a"]