-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjkfjsdlfjd.py
More file actions
186 lines (131 loc) · 5.19 KB
/
Copy pathjkfjsdlfjd.py
File metadata and controls
186 lines (131 loc) · 5.19 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
print("\nHello Rita\n")
herName = "Rita Rossweisse"
# # # We cant print both str and int/float/double at a single parameter # #
# # age = "25"
# # print("Age = " + age)
# # # Input/Scanner # #
# husbandName = input("\nWhat's the name of her husband? ")
# print("Her husband name is " + husbandName)
# birthYear = input("\nEnter her birth year = ")
# age = 2023 - int(birthYear)
# print("Her age is", age)
# myAge = 2023 - eval(input("Insert your birth year = "))
# ageDifference = age - myAge
# print("Your age difference with", herName, "is", ageDifference) # # How to combine 2 different data types in print() # #
# # # Define Functions # #
# def loveLetter():
# print("\nI love you, " + herName)
# loveLetter()
# print("\n", type(herName))
# print(type(age))
# # # Different kinds of basic print() methods # #
# print(hername, end="\t")
# print(herName[9])
# print(herName[-1])
# print(herName[4])
# print(len(herName))
# print(3*herName)
# print(herName[:4])
# print(herName[4:])
# print(herName)
# print(herName.upper()) #uppercase everything ( basically caps lock ON lol )
# herNameLower = herName.lower() # lowercase everything
# print(herNameLower)
# print(herNameLower.title()) # only capitalize the first letter for each word
# print(herName.capitalize()) # only capitalize the first letter of the whole sentence/string
# print(herName.swapcase()) # basically like capitalize but NEGATIVE aka Toggle Case
# print(herName.isalnum()) #check if all char are alphanumeric
# print(herName.isalpha()) #check if all char are all alphabetic
# print(herName.isdigit()) #check if string contains numeric
# print(herName.istitle()) #check if string contains title words
# print(herName.isupper()) #check if string contains upper case
# print(herName.islower()) #check if string contains lower case
# print(herName.isspace()) #check if string contains spaces
# # String/Lists Manipulation # #
# honkaiCharas = ["Kiana", "Mei", "Bronya", "Himeko", "Fu Hua", "Durandal", "Rita Rossweisse", "Seele"]
# print(honkaiCharas)
# print(honkaiCharas[6])
# print(honkaiCharas[-6])
# print(honkaiCharas[:])
# print(honkaiCharas[3:7])
# print(honkaiCharas[0:3]*2)
# print(honkaiCharas[6].split())
# print(honkaiCharas[6].count('s'))
# print(honkaiCharas[6].startswith("R"))
# print(honkaiCharas[6].startswith("r"))
# print(honkaiCharas[6].endswith("e"))
# print(honkaiCharas[2].replace("Bronya", "Bronya Zaychik"))
# print(honkaiCharas[2])
# print("Rita Rossweisse" in honkaiCharas)
# honkaiCharas.append("Theresa")
# print(honkaiCharas)
# honkaiCharas.insert(0,"Otto")
# print(honkaiCharas)
# honkaiCharas.remove("Otto")
# print(honkaiCharas)
# honkaiCharas.extend(["Rozaliya", "Liliya"])
# print(honkaiCharas)
# del honkaiCharas[9:11]
# print(honkaiCharas)
# honkaiCharas.sort()
# print(honkaiCharas)
# honkaiCharas.reverse()
# print(honkaiCharas)
# for honkaiChara in honkaiCharas: # printing in a column instead of a single line
# print(honkaiChara)
# print(len(honkaiCharas))
# print("\n\t Total of Charges : RM{0:0.2f}".format(total)) # formatting the price into 2 decimal points
# # # Dictionary # #
# honkaiElements = {"Physical" : "Palatinus Equinox", "Fire" : "Herrscher of Flamescion", "Ice" : "Herrscher of Reason"}
# print(honkaiElements)
# honkaiElements["Lightning"] = "Herrscher of Thunder"
# print(honkaiElements)
# # # Set # #
# ritaDataSets = {"Rita Rossweisse", "Great Britain", 1998, 25, 25}
# print(ritaDataSets) # only store unique data, no duplicates
# ritaDataSets.add(168)
# print(ritaDataSets)
# ritaAccurateDataSets = {"Rita Rossweisse", "Great Britain", 1998, 25, 56, 168}
# ritaDataSets.update(ritaAccurateDataSets)
# print(ritaDataSets)
# ritaDataSets.discard(56)
# print(ritaDataSets)
# for ritaDataSet in ritaDataSets:
# print(ritaDataSet)
# honkaiHerrschers = {"Herrscher of Flamescion", "Herrscher of Reason", "Herrshcer of Thunder"}
# honkaiHerrscherss = {"Herrscher of Finality", "Herrscher of Truth", "Herrscher of Origin"}
# print(honkaiHerrschers | honkaiHerrscherss) # OR print(honkaiHerrschers.union(honkaiHerrscherss))
# # # Selection in Python # #
# ritaAge = 25
# myAge = 21
# if(ritaAge > myAge):
# print("She's older than you")
# elif(ritaAge < myAge):
# print("You're older than her")
# elif(ritaAge == myAge):
# print("Both of you are at the same age")
# else:
# print("idk lol")
# # # For loop Repetition # #
def repetition() :
for i in range(5):
print(i," * 2 =", (i*2))
repetition()
print("\n")
def jumpRep():
for i in range(1, 10, 2): #It will starts at the first parameter(1), ends at 2nd parameter(10), increment by using the 3rd parameter(2)
print(i)
jumpRep()
# # # While Loop Repetition # #
def main():
sentinel = 1
while(sentinel==1):
response = input("When is Rita Rossweisse's birthday? ")
if(response == "1st of March"):
sentinel = sentinel + 1
main()
def optionalSentinel():
sentinel = 1
while(sentinel == 1):
sentinel = eval(input("Enter 1 to keep repeating this loop, 0 to exit : "))
optionalSentinel()