-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelloworld.py
37 lines (30 loc) · 975 Bytes
/
helloworld.py
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
"""
String manipulation
"""
a = 'one quote'
b = "two qoutes"
c = """three quotes"""
# Show variables in strings
print("tal tal tal one string: {0}, second string: {1}, third string: {2}".format(a, b, c))
print(f"This is the last string: {c}")
# Built in functions for strings
print("Capital will do: " + "capital".capitalize())
print("Replace will do: " + "NUR".replace("U", "I"))
print("Alpha Numeric checker: " + str("AlphaNumeric".isalpha()))
print("Alpha Numeric checker, socond try: " + str("NotAlphaNumeric3".isalpha()))
# Split
print("Some, CSV, Value".split(","))
split = "This is a Split".split(" ")
print("The 4th word in the split variable is: " + split[3])
# Boolean and None
nonType = None
print("This is a none type: " + str(nonType))
trueValue = True
falseValue = False
print("This is true: {0}, and this is false: {1}".format(trueValue, falseValue))
# If statements
number = 5
if number == 5:
print("Yes, it is")
else:
print("No, it is not!!")