Skip to content

Instantly share code, notes, and snippets.

@calthoff
Created September 16, 2020 20:19
Show Gist options
  • Save calthoff/3f6daff256b7e0053743e89de5a8ff2b to your computer and use it in GitHub Desktop.
Save calthoff/3f6daff256b7e0053743e89de5a8ff2b to your computer and use it in GitHub Desktop.
# exercise 1
for c in "Camus":
print(c)
# exercise 2
print("aldous was born in 1894.".capitalize())
# exercise 3
print("Where now? Who now? When now?".split('?'))
# exercise 4
print(' '.join(["The", "fox", "jumped", "over", "the", "fence", "."]))
# exercise 5
print("three" + "three" + "three")
print("three" * 3)
@PhymasSC
Copy link

PhymasSC commented Oct 14, 2020

Hi Sir, this is my code for exercise 3
list = "Where now? Who now? When now?".split('?') print(list)
but why do I get an extra blank index (3)?
['Where now', ' Who now', ' When now', '']

@shariqkhan010
Copy link

Ex-3
print("Where now? Who now? When now?".split(',')) - This prints the string as is, not sure why we did .split('?)?

@Neeraj577
Copy link

print("Where now? Who now? When now?".split('?'))

Hi Sir, this is my code for exercise 3
list = "Where now? Who now? When now?".split('?') print(list)
but why do I get an extra blank index (3)?
['Where now', ' Who now', ' When now', '']

Did you got the answer?
I am having same problem.

@HAKIDES
Copy link

HAKIDES commented Jun 9, 2023

to the ones still in this course and struggling like me in ex 3 just add equals sign then print it

@HAKIDES
Copy link

HAKIDES commented Jun 9, 2023

print3 = ("three" "three" "three")
print(print3)
multiplyinto3 = ("three" * 3)
print(multiplyinto3)

I like playing with it so I tried to change it and its still good

@aetrono
Copy link

aetrono commented Jun 16, 2024

Exercise 5 can be solved in multiple ways; however, the built-in IDE flags them all as incorrect, including the proposed solutions here, as shown in the screenshots below.

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment