ASCII codes(Part 2)

Computer Science Level pending

Find the sum of the ASCII Code of every character in "n0ts0e4sy"

Details and Assumptions: You may try Part 1


The answer is 826.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Girish Ramnani
Apr 28, 2014

x="n0ts0e4sy"

sum=0

for i in x:

 sum+=ord(i)

print(sum)

sum(ord(c) for c in 'n0ts0e4sy') functional paradygm

Hasmik Garyaka - 3 years, 8 months ago
Arijit Banerjee
Mar 5, 2014

class ASCII { public static void main(String args[]) {

int sum = (int)( ' n ' ) + 2*(int)( ' 0 ' )+ (int)( ' t ' ) + 2*(int)( 's' ) + (int)( ' e ' ) +(int)( ' 4 ' ) + (int)( ' y ' );
System.out.println(sum);

} }

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...