-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathless1.py
More file actions
155 lines (121 loc) · 2.11 KB
/
less1.py
File metadata and controls
155 lines (121 loc) · 2.11 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
Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
a = 'you'
b = 24
c = 5.6
d = False
print(type(a), type(b),type(c),type(d))
a = 1
b = 'me'
c = 5.6
print(a,b,c)
1 me 5.6
print(a + c)
6.6
me = 'He will come tomorrow.'
print(me.title())
He Will Come Tomorrow.
print(me.upper())
HE WILL COME TOMORROW.
print(me.lower())
he will come tomorrow.
you= 'what are you doing?'
print(me + you)
He will come tomorrow.what are you doing?
me = 1
you = 27
print(me + you)
28
us = 1
we = 27
print(me + us +you +we)
56
print('me' + us + 'you' +we)
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
print('me' + us + 'you' +we)
TypeError: can only concatenate str (not "int") to str
print('me'+'us'+'you'+'we')
meusyouwe
a = 'This is a \n new line'
print(a)
This is a
new line
b = '\t this is tab space'
print(b)
this is tab space
A = 'Hello'
print(a)
This is a
new line
print(A)
Hello
print(A.strip())
Hello
print(A.rstrip())
Hello
print(A.lstrip())
Hello
a = 'He is awesome'
print(len(a))
13
a = 'heisawesome'
print(len(a))
11
water = 4
rice = 5
full meal = water + rice
SyntaxError: invalid syntax
full_meal = water + rice
print(full_meal)
9
print(len(full_meal))
Traceback (most recent call last):
File "<pyshell#53>", line 1, in <module>
print(len(full_meal))
TypeError: object of type 'int' has no len()
f= 'good morning ghana'
print(f.upper())
GOOD MORNING GHANA
print(f.strip())
good morning ghana
print(f.title())
Good Morning Ghana
print(len(f))
18
18
18
s='see you'
d='later'
print(s+d)
see youlater
print(d+s)
latersee you
print(len(d))
5
a = 45.3
b = 23
print(a + b)
68.3
90 = w
SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
w = 456
e = 230
print(w+e)
686
V = 'WE ARE THE LAST OF OUR KIND'
print(V.lower)
<built-in method lower of str object at 0x000001B821C55160>
print(V.lower())
we are the last of our kind
print(V.title())
We Are The Last Of Our Kind
er = 'emergency rooms'
print(len(er))
15
3/2
1.5
z = 1.5
x = 34
print(x+z)
35.5