my_variable_3=10 my_variable ="this is my first string" my_variable_2="this is my second string" s= my_variable+" " + my_variable_2 print(s) counter=100 kilometer=20 m= 1.6*kilometer name='deepak' print(counter) print(m) print(name) var1=1 var2=10 print(my_variable_3) #Number:# print s[0] print s[1] print s[1+2] print s[3:7] #x= a[3:] #y= b[6:] #z=x+" "+y ###string:# #print(z) print s *2 + " "+"how are you" print s # Prints complete string # print s[0] # Prints first character of the string print s[2:5] # Prints characters starting from 3rd to 5th print s[2:] # Prints string starting from 3rd character print s * 2 # Prints string two times print s + "Hello how are you" # Prints concatenated string c="|)33|)@|<" print(c) print c[8 :] print(my_variable_3) list = ['tomatoes',5.5,'onions','curryleaves','pot','brinjal'] tinylist=[1,2,3,4,5,6,7] arraylist=['some long string.....................',45,56,67,78] print list print tinylist print arraylist tuple =( 'abcd', 786 , 2.23, 'john', 70.2 ) tinytuple=('abkusnbkcnbsdcd', 78545 , 2.0988098) print tuple+tinytuple dict = {} dict[1] = "This is one" dict[2] = "This is two" tinydict = {'name': 'john','code':6734, 'dept': 'how are You'} print dict[1] print dict[2] print tinydict print tinydict.keys() print tinydict.values() w=45 r=40 q=21 e=w**r//43 print(e) if (w==r): print"go ahead" else: print"No equalities" if (r==q==w): print"checking" else: print("checking for the last given value Still") if (r>w): print(" R is greater than any other") else: print("others are greater than R") words=["hello"] words.append("world") print(words.append) print(words[0]) list=[1,2,3,4] for var in list(): print (var)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question