我正在尝试编写一个python程序来查找素数

时间:2019-10-10 10:16:00

标签: python python-3.x

有很多方法可以做到这一点,但我想使用下面的代码来做到这一点:

"""
Find the number is prime or not
"""

num =100
print(f"{num} is{' not a' if num%2==0 else 'not a' if num%x==0 else 'a' for x in range(3,(num//2)+1,2)} Prime Number")

我得到以下输出:

100 is<generator object <genexpr> at 0x000001A5E440F0F8> Prime Number 

1 个答案:

答案 0 :(得分:0)

您正在以public minDate: newDat(); minDate = this.invoice.invoiceDate.setDate(this.invoice.invoiceDate.getDate() + 30); 格式创建一个生成器对象。

您可以使用[min]="minDate"的{​​{1}}方法获得文字值 将00:47 deploy:assets:precompile 01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile 01 [Simple Form] Simple Form is not configured in the application and will use the default values. Use `rails generate simple_form:install` to generate the Simple Form configuration. 01 I, [2019-10-10T11:01:27.724567 #10699] INFO -- : Writing /home/deploy/webmenue/releases/20191010110029/public/assets/pdf-9124940acc21064e2797d4fc331490b7dd2616867e513e126f2a163025a71bc7.css 01 I, [2019-10-10T11:01:27.725085 #10699] INFO -- : Writing /home/deploy/webmenue/releases/20191010110029/public/assets/pdf-9124940acc21064e2797d4fc331490b7dd2616867e513e126f2a163025a71bc7.css.gz 01 I, [2019-10-10T11:01:27.728319 #10699] INFO -- : Writing /home/deploy/webmenue/releases/20191010110029/public/assets/MultiFactor-ec7b30855ff129ef43275ce9047d6b28196613335a7fde0aa2b9b937c7e7b0e6.png 01 I, [2019-10-10T11:01:27.733297 #10699] INFO -- : Writing /home/deploy/webmenue/releases/20191010110029/public/assets/logo-d3cf944e7b444e9265ffc5708b91386900a04c498681b2ee8b4537e92ce93757.jpg 01 I, [2019-10-10T11:01:27.737513 #10699] INFO -- : Writing /home/deploy/webmenue/releases/20191010110029/public/assets/top-1b883a805cfc1445462e1accd2d4f9db4062476e1d0ca24842f2691e8ca72231.png 01 I, [2019-10-10T11:01:28.315834 #10699] INFO -- : Writing /home/deploy/webmenue/releases/20191010110029/public/assets/express/lib/application-9232ebdb20ad39572e70fb9e29810e63dbb63b58f5f18617c7c2bc8… 01 I, [2019-10-10T11:01:28.316656 #10699] INFO -- : Writing /home/deploy/webmenue/releases/20191010110029/public/assets/express/lib/application-9232ebdb20ad39572e70fb9e29810e63dbb63b58f5f18617c7c2bc8… 01 Compiling… 01 Compilation failed: 01 #<Thread:0x00000000031d6db8@C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true): Traceback (most recent call last): 1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@142.93.104.71: rake exit status: 1 (SSHKit::Runner::ExecuteError) 格式替换为:

f-string

输出:

str