-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrings.py
More file actions
31 lines (21 loc) · 811 Bytes
/
strings.py
File metadata and controls
31 lines (21 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Strings are immutable in Python
# To input a user's name and print good afternoon
# name = input("Enter your name: ")
# print("Good Afternoon,", name) #No need to add extra space after Afternoon,", it automatically does it
# print(f"Good Afternoon, {name}") # use f for template literal
# date = input("Enter a date: ")
# This doesn't work
# letter = """
# Dear {name},
# You are Selected!
# {date}"""
# letter = """
# Dear {name},
# You are Selected!
# {date}"""
# print(letter.replace("|<name>|", name).replace("|<date>|", date)) #this work
# print(letter)
# doublestr = "This contains double spaces"
# print(doublestr.find(" ")) #finds the index of first double space, or -1 if not found
letter = "Dear User,\nYou are a genius. \nThanks for enrolling!"
print(letter)