I am a python developer and I am taking the course to brush up on my C language skills. During the week 2 lecture (continued), David shows how a loop iteration can be used to access indices in a string. I am able to make the following simple script I wrote run on my windows Python IDLE editor + console. However, the same script does not run in the cs50 appliancewith the error
Traceback (most recent call last): File "test.py", line 1, in <module> s = input("Enter a string: ") File "<string>", line 1, in <module> NameError: name 'This is cs50' is not defined
Here is my script, which takes a user input string and separates the capitalized letters from the lowercase letters using a method similar to the weeks example:
s = input("Enter a string: ") lower = '' upper = '' for char in s: if char >= 'a' and char <='z': lower += char elif char >= 'A' and char <= 'Z': upper += char print(lower) print(upper)
As I said, this works fine in my windows environment, but not the cs50 appliance. If anyone could figure out why this is exactly, I'd appreciate it!