Python

11 flashcards · Programming Languages · by Daniel Blackbird

  1. what difference between assign "string" and 'string'

    x = "John" # is the same as x = 'John'

  2. how to combine both text and a variable in print x = "awesome" print("Python is " + x)

  3. how can assign the same value to multiple variables in one line?(x,y,z) x = y=z= "Orange"

  4. write this code : x<=4 x<=hello print(x) ------------------------------------ x=4 x="hello" print(x)

  5. comment this code : #print ("yes")

  6. write a code for this : if 3>2 number then print its greater than it . if 3>2: print("its greater than it")

  7. print hello world in python print("Hello World")

  8. solve space problem that if x==1 then print "x is 1". x = 1 if x == 1: print("x is 1.")

    x = 1 if x == 1: print("x is 1.")

  9. make a integer variable and assign 7 to it . and print it myint = 7 print(myint)

  10. make a list and append 1,2,3 to it and print them 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

  11. comment this multi line : if (x>2): print ("yess")

    """ if (x>2): print ("yess") """