Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute Python Online

sat_polaska=16
minut_polaska=30
sat_putovanja=2
minut_putovanja=45
ukupno_polaska_min=sat_polaska*60+minut_polaska
ukupno_putovanja_min=sat_putovanja*60+minut_putovanja
sat_dolaska=(ukupno_polaska_min+ukupno_putovanja_min)//60
minut_dolaska=(ukupno_polaska_min+ukupno_putovanja_min)%60
print(sat_dolaska, minut_dolaska)

practice

counter=1236
miles=2365.2
name="pavan"
print counter
print miles
print "name",name

Execute Python Online

# Hello World program in Python
list = [ 'abcd', 786, 2.23, 'john', 70.2 ]
tinylist = [123, 'john']
print list
print list [0]
print list [1:3]
print list [2:]
print tinylist *2
print list + tinylist

Execute Python Online

# Hello World program in Python
    
print "Hello World!\n"

test if done right

print("the answer can't be two! ")
x=input("")
y=input("")
z="{}+{}".format(x, y,)
b=(2)
e=(int(x)) + (int(y))
print("you are doing: ")
print(z)
print("now to check, ")
if (e) == (b):
    print("that no work, because it 2...")
else:
    print("good job billy you be doing the good stuff!")

Execute Python Online

#!/usr/bin/python
str = 'Hello World!'

print str # Prints complete string
print str[0] # Prints first character of the string
print str[2:5] # Prints characters starting from 3rd to 5th
print str[2:] # Prints string starting from 3rd character
print str * 2 # Prints string two times
print str + "TEST" # Prints concatenated string

Execute Python Online

#!/usr/bin/python
list = [ 'abcd', 786 , 2.23 , 'john', 70.2 ]
tinylist = [123, 'john']
print list # Prints complete list
print list[0] # Print first element of the list
print list[1:3] # Prints elements starting from 2nd till 3rd
print list[2:] # Prints elements starting from 3rd element
print tinylist * 2 # Prints list two time
print list + tinylist # Prints concatenated list

img_regex

# Hello World program in Python

print "Hello World!\n"
import re
def special_match(strg, search=re.compile(r'[^\ (img\)]').search):
    return not bool(search(strg))

print("imaaaaasaassg sadasd asdasd")
print(special_match("(img) (img)     (img)"))

IfElse

m = 5
if m == 1 or m == 4:
    print("x") 
else:
    print("y")

Execute Python Online

#!/usr/bin/python
list = [ 'abcd', 786 , 2.23, 'john', 70.2]
tinylist = [123, 'john']
print list          # Prints complete list
print list[0]       # Prints first element of the list
print list[1:3]     # Prints elements starting from 2nd till 3rd
print list[2:]      # Prints element starting from 3rd element
print tinylist * 2  # Print list two times

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.