I don't understand how to do the first problem with the amount of commands provided by the first two lecture. I am not understanding how to solve this problem without using arrays
What is the first problem?
Python is really simple, don't over think it. You'll need to google search for details of commands, maybe grab a text book/ ebook or something. In C/C++ you'd need an array to do the first problem, in Python raw_input will just store the whole string. You'll also need to use the print command, real simple.
I agree with Neil in that you shouldn't over think it. You should first create two string variables in which you will use the "raw_input" function in order to bind your input from the keyboard to your strings. There after use the print command to print out your two strings.
The lectures assumed people knew a little more about programming. Remember, students in these classes had access to a 5 week class that was just on basic coding and taking in conjunction, a book, and recitation (smaller classes with a grad student leading them.) I suggest that people watch the first 10 to 15 videos here: https://buckysroom.org/videos.php?cat=36 They are short and cover individual topics. They are NOT rigorous, so they do not really cover the proper form of programming. But they are a good complement to getting you the very basics needed to make the class easier.
I meant for the prime number problem sorry for not clarifying prime = [2] while len(prime) <= 1000: i=3 a = 0 for number in prime: testlist= [] testlist.append(i%number) if 0 in testlist: i=i+1 else: prime.append(i) i=i+1 print(prime[999]) for some odd reason this doesn't work. I can't seem to find an infinite loop though.
Try with a small number, like looking for the first 25, and put in some print statments so you can see when different parts of the program are being called.
Join our real-time social learning platform and learn together with your friends!