What do you want to save?
Add Code snippet
New code examples
-
Python 2021-08-29 20:38:01
how to check if a number is armstrong in python
num = 1634 # Changed num variable to string, # and calculated the length (number of digits) order = len(str(num)) # initialize sum sum = 0 # find the sum of the cube of each digit temp = num while temp > 0: digit = temp % 10 sum += digit ** o... Add solution -
Other 2021-08-29 20:06:02
AttributeError: 'numpy.ndarray' object has no attribute 'value_counts'
# Counting values from a numpy array import numpy as np a = np.array([0, 3, 0, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 3, 4]) unique, counts = np.unique(a, return_counts=True) dict(zip(unique, counts)) output: {0: 7, 1: 4, 2: 1, 3: 2, 4: 1} # Counting values f... Add solution -
Python 2021-08-29 19:09:02
declare double python
x = 5 print(type(x)) # Output: <class 'int'> Add solution -
-
Python 2021-08-29 15:54:02
tkinter radiobutton
from tkinter import * root = Tk() i = IntVar() #Basically Links Any Radiobutton With The Variable=i. r1 = Radiobutton(root, text="option 1", value=1, variable=i) r2 = Radiobutton(root, text="option 2", value=2, variable=i) # "&q... Add solution -
Python 2021-08-29 13:27:02
positional vs keyword arguments python
# POSITIONAL ARGUEMENTS ARE AS THE NAME SAYS THEY ARE POSITIONED # THE KEYWORD ARGUEMETS ARE DEFINED WITH THEIR KEYS LIKE FOLLOWING # function that greets from name and their location # {output}: Hello name, how is it in {location} def greet(name, locat... Add solution