Jump to content

Maybe a little TOO easy?

- - - - -

  • Please log in to reply
1 reply to this topic

#1
chrisbregg

chrisbregg

    Newbie

  • Members
  • Pip
  • 9 posts
I'm not sure its a good thing that Python lets you create a program which:
  • Takes a list of numbers as input
  • Converts the strings to integers
  • Adds the numbers together
  • Outputs the result
All in a single line, but ****it if that isn't cool.

print(sum([int(data) for data in input('Please enter some numbers ').split(' ')]))


#2
Skippy

Skippy

    Programmer

  • Members
  • PipPipPipPip
  • 146 posts
Thats why scripting languages are used a lot for those types of tasks. What takes minutes in a scripting language could take hours in a programming language such as c.

I think it's a really nice feature about scripting languages, it's why I started learning how to script.

Interested in participating in community events?
Want to harness your programming skill and turn it into absolute prowess?
Come join our programming events!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users