Python学习第五天

#!/usr/bin/python

# -*- coding:UTF-8 -*-


print ('not(2) result',not(2))

print ('not(0) result',not(0))

print ('not(-1) result',not(-1))


# this is about prime, but I am totally confused

# so I just practise the grammar


i = 2

while (i < 100):

j = 2

while(j <= (i/j)):

if not(i%j):break

j = j + 1

if( j > i/j): print (i,'  is a prime number')

i = i + 1

print ('good bye')


# part two: break


for letter in 'Python':

if letter == 'h':break

print ('current letter:',letter)


var = 10

while var > 0:

print ('Current variable value:',var)

var = var - 1 

if var == 5:break

print ('good bye')


# part three: continue

for letter in 'Python':

if letter == 'h':continue

print ('current character:',var)

print ('good bye')


#part four:pass

for letter in 'Python':

if letter == 'h':

pass

print ('is there any situation to use "pass"')

print ("current character",letter)

print ("good bye")



#  part five : del

var1 = 1

var2 = 10 

del var1,var2

# print ('var1',var1) # after del this sentence is an error



你可能感兴趣的:(Python学习第五天)