any high iq cs majors here? i can't fail this question or ill get kicked out
CS majors
Other urls found in this thread:
wats ur ?, bro
much appreciated
dude. that's like first semester CS stuff. you probably just didn't pay attention. it's not a lack of IQ, if you can't handle that little task
You should indeed get kicked out if you don't know this you faggot
Sorry I'm depressed
Use nested for loops. The inner one copies and prints the word five times, then increments the outer one. The outer one adds a /n and repeats four times.
Or you could use a while loop for the outer one, just check that the next character isn't the end of file character.
ez pz
well i couldn't use online labs like the rest of the class cause im poor. but anyways can any of you pleease hep me with this
ask . maybe someone there will help you with your homework
care to demonstrate? pls bro i will worship you
orignsss
this. dude I didn't even go to college and I could probably do this in python wtf. i.e. it's not that hard.
The best advice I can give would be this:
Stop psyching yourself out. If someone gave you these instructions along with a hand-written "test file" you would know how to copy it to another sheet of paper, by hand, based on the instructions, right?
Now come up with ideas about how to do that in python and try them out until one works. One idea might be to just read the file in and then write it back out. Does that solve the problem all the way? No. Does it get us closer to a solution or constrain the problem in a way that reduces cognitive load? Hm.
I don't understand what's so difficult about this task? What language?
Pyhon retard
Now get the fuck out you retard
you do not know how much i love you right now
do you happen to have a discord
ororor
are you in the US or a some third world country? you said you were too poor for something
>cs major
>high iq
>failing test
choose one
ystah#3133
Honestly OP, if you're having difficulty with this then you need to redouble your studies. Stop watching anime, playing vidya, going on Yas Forums, etc. Seriously. While I'm not super familiar with python, these concepts are easy shit I learned in high school.
just realized counter might be unnecessary. eh, whatever
>pastebin.com
Dude is this a troll? If you're gonna call yourself "high iq", don't post a 10-minute phone screen question to weed out bad candidates.
This code is also bad. You used the same `i` variable for both nested `for(` loops.
uh
He's not calling himself high iq.
he's asking for a high iq person to give him help
The condition is also i > 0, while i is increasing, this is all sorts of dumb.
This. This entire thread is low IQ without any reading comprehension.
lol you are very stupid
I will hunt down and execute every CS majors individually
1. Use fopen("file.txt", "r") to open the file. Read the sentence and store as a variable
2. Filter out all special characters from the string.
3. Trim and split the string to get an array of words.
4. Create a new variable representing the final output.
5. Loop over the words using a non-modified for loop (ie., a counter). Append the word to the new variable. Pri When the for loop + 1 % 5 is zero, append a new line. Otherwise, add append a space.
6. Write the contents of this variable to a new file using the "w" flag.
Done.
?? don't reply to me dummy
I just got here, nig
It's going to be funny if he fails because you guys told him to leave trailing whitespace.
Basically what I have done here .
But yeah all lines have whitespace at the end, the prof would be a jerk if they have him shit because of it though.
this is so fucking easy... not even done with a bachelor degree
CS classes are full of people who dont know shit nowadays
[code]
file = open("penis.txt","w")
file.write("I am a barbie girl i have a big penis and this sentence has 20 words because my dick long.")
file.close()
file = open("penis.txt","r")
content = file.read()
content_list = list(content)
spacecounter = 0
for i in range(len(content)):
if content[i]==" ":
spacecounter+=1
if spacecounter%5==0 and spacecounter!=0:
content_list[i]=" \n"
file.close()
newcontent ="".join([i for i in content_list])
secondFile = open("vagina.txt","w")
secondFile.write(newcontent)
[/code]