Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Escape indentation
#5
I agree with you. My goal was to print the result with and without a list.
At first i wanted to print without a list but ended up with False and True. Removing false or true get you a none.
Than i returned n to only get the primes. But true is in output. I tried for fun Ruby language. I like the idea to not have to return something (return is automatic). In python you have to return otherwise nothing comes out.

In the end your solution is what i was looking for. Just that was enough:

for n in range(1,21):
  if is_prime_v1(n):
   print(n)
     
print(prime)  
Again a logic problem i suppose.
Reply


Messages In This Thread
Escape indentation - by Frankduc - Jan-28-2022, 02:25 PM
RE: Escape indentation - by BashBedlam - Jan-28-2022, 02:53 PM
RE: Escape indentation - by Frankduc - Jan-28-2022, 03:05 PM
RE: Escape indentation - by snippsat - Jan-28-2022, 03:13 PM
RE: Escape indentation - by Frankduc - Jan-28-2022, 03:36 PM
RE: Escape indentation - by Gribouillis - Jan-28-2022, 03:41 PM
RE: Escape indentation - by Frankduc - Jan-28-2022, 04:07 PM
RE: Escape indentation - by deanhystad - Jan-28-2022, 04:24 PM
RE: Escape indentation - by Frankduc - Jan-28-2022, 04:50 PM
RE: Escape indentation - by deanhystad - Jan-28-2022, 07:24 PM
RE: Escape indentation - by Gribouillis - Jan-28-2022, 09:59 PM
RE: Escape indentation - by Frankduc - Jan-31-2022, 02:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  use of escape character in re.sub and find WJSwan 1 961 Feb-16-2023, 05:19 PM
Last Post: Larz60+
  add Escape charcters in string GrahamL 3 1,242 Jan-20-2022, 01:15 PM
Last Post: GrahamL
  Escape Single quotation between each content tag usman 3 2,912 May-02-2021, 03:32 PM
Last Post: snippsat
  DIY Escape Room for fun StannemanPython 1 2,387 Feb-17-2021, 10:53 PM
Last Post: maurom82
  How to escape OrderedDict as an argument? Mark17 2 2,089 Dec-23-2020, 06:47 PM
Last Post: Mark17
  help for escape sequences NewPi 1 2,089 Dec-11-2019, 11:22 PM
Last Post: ichabod801
  escape single quote deep_logic 1 1,851 Sep-10-2019, 08:05 PM
Last Post: SheeppOSU
  The use of escape char \ hishamzero1 2 2,437 Aug-12-2019, 10:20 PM
Last Post: hishamzero1
  Escape sequences display in python Uchikago 1 2,494 Jun-27-2019, 03:25 PM
Last Post: Gribouillis
  Python 3 escape codes oldDog 1 2,650 Sep-15-2018, 10:12 AM
Last Post: gruntfutuk

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020