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

python battles

# Hello World program in Python
    
print ("Hello World!");

yyyytggg

X=[3,4]
print(X)
y=tuple(X)
print(type(y))
print(y)

Execute Python-3 Online

print ("Task#0-01-03. NIM Saya : 171080200034")

python 3 latest

#Learning Python online

'''
# sum example 
num1 = 1.5
num2 = 6.3
num3 = 3.5
num4 = 3334.3


# Add two numbers
sum = float(num1) + float(num2)

sum1 = float(num1) + float(num2)

# Display the sum
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

print('the sum of {0} and {1} is {2}'.format(num3, num4, sum1))

'''

'''
# square root example
num = 8
num_sqrt = num ** 0.5
print('the square root of %0.3f is %0.3f' %(num,num_sqrt))
'''


'''
# square root example using complex numbers
import cmath
num = 8 +3j
num_sqrt = cmath.sqrt(num)
print('The square root of {0} is {1:0.3f}+{2:0.3f}j'.format(num ,num_sqrt.real,num_sqrt.imag))

'''

'''
print('This sentence is output to the screen')
# Output: This sentence is output to the screen

a = 5

print('The value of a is', a)
# Output: The value of a is 5

'''
'''
print(1,2,3,4)
# Output: 1 2 3 4

print(1,2,3,4,sep='*')
# Output: 1*2*3*4

print(1,2,3,4,sep='#',end='&')
# Output: 1#2#3#4&
'''


'''
print('I love {0} and {1}'.format('bread','butter'))
print('I love {0} and {1}'.format('bread', 'butter'))
# Output: I love bread and butter

print('I love {1} and {0}'.format('bread','butter'))
# Output: I love butter and bread

print('Hello {name}, {greeting}'.format(greeting = 'Goodmorning', name = 'John'))
'''

#Python Input


num = input('Enter a number: ')
print(num)









string isdecimal

#!/usr/bin/python3

str = "this2016"
print (str.isdecimal())

str = "23443434"
print (str.isdecimal())

String maketrans() Method

#!/usr/bin/python3

intab = "aeiou"
outtab = "12345"
trantab = str.maketrans(intab, outtab)

str = "this is string example....wow!!!"
print (str.translate(trantab))

strings

# Hello World program in Python
    
print ("Hello World!");

Execute Python-3 Online

# Hello World program in Python
    
print ("Hello World!");

qwe1

# Hello World program in Python
    
print ("Hello World!");

i=9
while i>0:
    print(i)
    i-=1

fibonacci

max_num = 100;

def isFibonacciNum(num):
    bk_num = 0;
    i = 1;
    while i < max_num:
        if (i == num):
            return True;
        temp = i;
        i = i + bk_num;
        bk_num = temp;
        
    return False;
    

print (isFibonacciNum(55));

Advertisements
Loading...

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