+ 1
Even nums 1-100 in multiple ways
Hi all, I like this possibility of solving one task in multiple ways. For start I prepared this bit of code with 3 ways to display even numbers in range 1-100. Maybe you have some other interesting suggestions? https://sololearn.com/compiler-playground/ccDNuh8sd0mp/?ref=app
4 Respostas
+ 7
Paweł Dudek ,
Using slicing... you can print even numbers in given range...try this...
https://sololearn.com/compiler-playground/c1Vat23YX7m1/?ref=app
+ 4
Hi Paweł Dudek,
Here's som ways to print even numbers in Python:
https://sololearn.com/compiler-playground/cZoO81JRqldL/?ref=app
+ 4
#This would print even whole numbers in floating point
import math as M
print(*map(lambda x:(x-~x-M.e**(0+M.pi*1j)).real, range(100>>1)))
+ 3
for i in range(51):
print(i<<1)