Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Game4
#python 3.6.9 def main(): print ("Hello, world!") # example of how to build a list. mylist = [ ] mylist.append(1) mylist.append(2) mylist.append(3) print(mylist[0]) # prints 1 print(mylist[1]) # prints 2 print(mylist[2]) # prints 3 # prints out 1,2,3 for x in mylist: print(x) #sequence or string x = 4 y = 8 list = [1, 2, 3, 4, 5 ]; if ( x in list ): print("Line 1 - x is available in the given list") else: print("Line 1 - x is not available in the given list") if ( y not in list ): print("Line 2 - y is not available in the given list") else: print("Line 2 - y is available in the given list") import random from random import randint var = 100 if var == 200: print("1 - Got a true expression value") print (var) elif var == 100: print( "2 - Got a true expression value") print (var) else: print ("3 - Got a false expression value") print (var) value = randint(1,10) #1 and 10 represent the range for your #random value count = 0 print(value) Num1 == value count += 1 if count < 3: value2 = randint(1,10) value3 = randint(1,10) print (value2) print (value3) elif: print ("end", Num1) else: print ("less than 3") main ()
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
31 dec
ggh
public,protec,pvt
list_copy_shallow_deep.py
abstract base class
prog1.py
benda x guna
Ex1
Repeated match within another regular expression
thermal_containers
Please log in to post a comment.