Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ad92564

Browse files
author
Amogh Singhal
authored
Update hundred_without_int.py
1 parent 91f314b commit ad92564

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎hundred_without_int.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,17 @@
1919
# 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2020
# 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2121
# 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
22+
23+
24+
# ALTERNATE APPROACH
25+
# ORD (or "ordinal") function in python gives the ASCII
26+
# (American Standard Code for information interchange) value
27+
# of characters ranging from 0-256 in 8 bits of memory which
28+
# is equal to a byte.
29+
30+
ONE = str(ord('b') - ord('a'))
31+
ZERO = str(ord('a') - ord('a'))
32+
HUNDRED = int(ONE + ZERO + ZERO)
33+
34+
for i in range(int(ONE), HUNDRED+1):
35+
print(i, end=', ')

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /