Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

basic python programs

print("Basic Programs")
s = input("Enter your name")
print("Hi" + s)
Comment

python basic programs

print('The sum is %.1f' %(float(input('Enter first number: ')) + float(input('Enter second number: '))))
Comment

python basic programs

# Find square root of real or complex numbers
# Importing the complex math module
import cmath

num = 1+2j

# To take input from the user
#num = eval(input('Enter a number: '))

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))
Comment

best python programs

ax = plt.axes(projection=’3d’)# Data for a three-dimensional line
zline = np.linspace(0, 15, 1000)
xline = np.sin(zline)
yline = np.cos(zline)
ax.plot3D(xline, yline, zline, ‘gray’)# Data for three-dimensional scattered points
zdata = 15 * np.random.random(100)
xdata = np.sin(zdata) + 0.1 * np.random.randn(100)
ydata = np.cos(zdata) + 0.1 * np.random.randn(100)
ax.scatter3D(xdata, ydata, zdata, c=zdata, cmap=’Greens’);
Comment

python basic programs

# Python Program to calculate the square root

# Note: change this value for a different result
num = 8 

# To take the input from the user
#num = float(input('Enter a number: '))

num_sqrt = num ** 0.5
print('The square root of %0.3f is %0.3f'%(num ,num_sqrt))
Comment

best python programs

theta = 2 * np.pi * np.random.random(1000)
r = 6 * np.random.random(1000)
x = np.ravel(r * np.sin(theta))
y = np.ravel(r * np.cos(theta))
z = f(x, y)
ax = plt.axes(projection=’3d’)
ax.plot_trisurf(x, y, z,cmap=’viridis’, edgecolor=’none’);
Comment

best python programs

<pre id="3346" class="graf graf--pre graf-after--p">%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = plt.axes(projection=’3d’)</pre>
Comment

PREVIOUS NEXT
Code Example
Python :: tkinter filedialog filename 
Python :: pynput keyboard backspace 
Python :: activate venv in python 
Python :: python function to do comparison between two numbers 
Python :: jquery datepicker disable 
Python :: Convert .tif images files to .jpeg in python 
Python :: python inherit 
Python :: how to check if a string value is nan in python 
Python :: python check if variable has value 
Python :: gui with pygame 
Python :: python sort list case insensitive 
Python :: how to use underscore in python 
Python :: exercices pyton 
Python :: diccionario python 
Python :: python if else interview questions 
Python :: create period pandas 
Python :: python random distribution 
Python :: get status code python 
Python :: class views django slug 
Python :: propositional logic python 
Python :: c is better than python 
Python :: how to make an action repeat in python 
Python :: gnuplot sum over a column 
Python :: emacs pipenv not working 
Python :: como calcular el rango en python 
Shell :: get cpu frequency linux 
Shell :: yarn emojis 
Shell :: update google chrome command ubuntu 
Shell :: git username email 
Shell :: install openzeppline 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =