is anyone good in computer science please help me out with writing 3 codes pleasee
i'm trying to learn python this summer... sorry, can't help... yet....
if i give you a code would you be able to inrpret what it means because i am strictly all math and stats based student and this is my first computer class which is really confusing for me
what is the code?
yeah... lessee it....
it says the parameter name is convert_to_upper: (list of strs) -> NoneType and the description is Convert the strs in the given list to uppercase.
i have no idea sorry
post it in computer science... i'm sure you'll get better response there...:) btw.... what language?
and its in python but yeah i am for the past 2 days but no one is replying
hmm... i guess i'll come up to that problem sometime to then...:(
lol but yeah do you have any clue in this or noo
no clu.... sorry...:(
paste the code here
it says the parameter name is convert_to_upper: (list of strs) -> NoneType and the description is Convert the strs in the given list to uppercase.
based on the pseudo code you asked: it simply takes a list of characters such as a - z and converts them to upper case, so a would become A, b would become B
yeah exactly
yeah so what do you need to know exactly?
how do i make this code run
are you writing it or is it given
like for this first code i did by my self and it said the parameter name is remove_vowels: (str) -> str and the description was Return a new str that is identical to the input str except that the vowels have been removed. Vowels are the letters a,e,i,o,u. We do not consider y a vowel. and then i wrote my code on wing vowels = 'aeiou' def remove_vowels(a): return ''.join(c for c in a if c not in vowels) and that worked and yeah i have to make it
but i dont get how to do this code and this other one
I work with java, apart from the syntax difference maybe I could help you out, since no one else knows python here. Try me!
yes could you please help me out it would be really appreciatedd
il try my best, post it here
do you understand that code though? i need help on this code it says the parameter name is convert_to_upper: (list of strs) -> NoneType and the description is Convert the strs in the given list to uppercase.
do you have to write this method?
yess
what is NoneType ? and does it return a string?
no it is suppose to return a nonetype
what is a nonetype?
it returns nothing and just the capital letters
oh i see, in java we would write it as convert_to_upper(list of strings) { strings.toUpperCase(); }
what is your code?
oo i dont know how to use python and needed someone to help me how to write it on that
try something like this: >>> [x.lower() for x in ["A","B","C"]] ['a', 'b', 'c'] >>> [x.upper() for x in ["a","b","c"]] ['A', 'B', 'C']
so: for item in L: item.upper()
its not working my friendd
go here, it shows you how to loop over the lists. http://effbot.org/zone/python-list.htm
The reason javawarrior's code won't work is that strings are immutable; you can write over them, but you can't change them. So the line should say item = item.upper() instead of just item.upper().
And don't forget to return L once you're done. Actually, javawarrior's first code would work as long as you return that list: def converter(string_list): return [s.upper() for s in string_list]
hey @shandelman could you help me out with this code as well please?
it says the parameter name is get_x_strs: (list) -> list of strs and the description is Given a list l, return a new list that contains only the elements of l that are strs that contain the character 'x'. Do not alter l.
so what i did was first def get_x_strs (list_strings): return (x for s in list_strings) but it doesnt work
Sure. The first thing I'll say is that, while a lot of functions can be written in Python in one line, they certainly don't HAVE to be, and they're often more easily understood and read if you can spread them out to multiple lines. For this problem, it might be best to reword it. You're given a list of strings, and what you need to do is walk through the list of strings, and for each string, you need to check if an 'x' is in it. If it is, you're going to add that string to a result list, and otherwise, you're just going to ignore it and keep going. So you're right in that a for loop will make your life easier. We also need some other list to stick all the words with x in them. So the general code will look like this: def get_x_strs(list_strings): results = [] # This is where our strings with 'x' will go for word in list_strings: if _________________: # Here, we want to check if the word contains an x. The 'in' keyword makes this pretty easy. _______________ #Here, we want to put the word into the results list. Again, the append() method is what is needed. return results See if you can fill in the rest yourself.
Join our real-time social learning platform and learn together with your friends!