Techtalks: Traveltech
Python Code Error
Hi
I am using built in functions and libraries for this python code and I am trying to execute this code, but it is showing NameError.
import
time
# slower (Without map())
start
=
time.clock()
s
=
'geeks'
U
=
[]
for
c
in
s:
U.append(c.upper())
print
(U)
elapsed
=
time.clock()
e1
=
elapsed
-
start
print
(
"Time spent in function is: "
, e1)
# Faster (Uses builtin function map())
s
=
'geeks'
start
=
time.clock()
U
=
map
(
str
.upper, s)
print
(U)
elapsed
=
time.clock()
e2
=
elapsed
-
start
print
(
"Time spent in builtin function is: "
, e2)
Thanks.
asked Sep 7, 2022
answered Oct 17, 2022
Hy Guys,
CCSP Course
With the help of this CCSP online training certification course, develop your knowledge of cloud security architecture, design, applications, and operations. You will get step-by-step instructions and a comprehensive lesson plan that is simple to follow covering every aspect of the CCSP, which will help you further your career in the expanding sector of cloud security.
answered Dec 5, 2023
Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information. UFABETเว็บแทงบอลดีสุด