text
stringlengths
5
121k
string = 'qwertyuiopasdfghjklzxcvbnm,asdfghjkqwyeqeqrqemneiwibf' letter = input('letter is :') print(string.count(letter), 'times')
"""Binary to Decimal and Back Converter - Develop a converter to convert a decimal number to binary or a binary number to its decimal equivalent. """ import sys print( 'This program converts a number from Binary to Decimal or from Decimal to Binary.') def binary_to_decimal(n): print(int(str(n), 2), '\n') d...
n = 42; f =7.03; s = 'string cheese' print('%10.4d %10.4f %10.4s' % (n, f, s)) print('%*.*d %*.*f %*.*s' % (10, 4, n, 10, 4, f, 10, 4, s)) print('{} {} {}'.format(n, f, s)) print('{n} {f} {s}'.format(n=42, f=7.03, s='string cheese')) print('{2} {0} {1}'.format(n, f, s)) d = {'n':42, 'f':7.03, 's':...
import numpy as np b = np.array([2, 4, 6, 8]) print(b) print(b.ndim) print(b.size) print(b.shape) a = np.arange(10) print(a) print(a.ndim) print(a.shape) print(a.size) a = np.arange(7, 11) print(a) f = np.arange(2.0, 9.8, 0.3) print(f) g = np.arange(10, 4, -1.5, dtype=np.float...
''' 파이썬에서 디버깅하는 가장 간단한 방법은 문자열을 출력하는 것이다. - vars() : 함수의 인자값과 지역 변수값을 추출 ''' def func(*args, **kwargs): print(vars()) func(1, 2, 3) ''' 데커레이터(decorator)를 사용하면 함수 내의 코드를 수정하지 않고, 이전 혹은 이후에 코드를 호출할 수 있다. ''' def dump(func): "인자값과 결과값을 출력한다." def wrapped(*args, **kwargs): print("Function name: {}"...
from random import randint def terningkast(): kast = int(input("Hvor mange terningkast?")) seksere = 0 for i in range(kast): if randint(1,6) == 6: seksere +=1 print("Antall seksere:") print(seksere) terningkast()
import numpy as np """GETSHUFFLE provides a permutation and inverse permutation of the numbers 1:N. perm: for shuffling invPerm: for unshuffling""" def getShuffle(n): perm = np.random.permutation(n) invperm = perm[::-1] return perm
import random class Puzzle: '''The purpose of this class is to randomly select a word from the word list. Sterotyope: Game display Attributes: word_list (list): a list of words for the puzzle to choose from chosen_word (string): a random word from the word list create_...
"""Various conveniences. Higher-level libraries like Skyfield that use this one usually have their own date and time handling. But for folks using this library by itself, native Python datetime handling could be convenient. """ import datetime as dt import sgp4 from .functions import days2mdhms, jday class _UTC(dt....
import random def getAnswer(answerNum): if answerNum == 1: return 'It is certain' elif answerNum == 2: return 'It is decidedly so' elif answerNum == 3: return 'Yes' else: return 'Ask again later' r = random.randint(1,9) fortune = getAnswer(r) print(fortune)
def listUnfold(listBefore): listAfter = [] for value in listBefore: if type(value) == list: listMid = listUnfold(value) for item in listMid: listAfter.append(item) else: listAfter.append(value) return listAfter def ...
def min_to_day_hour_minute(minutes): min_per_day = 24 * 60 d = minutes // min_per_day h = (minutes - (d * min_per_day)) // 60 m = minutes - (d * min_per_day + h * 60) return (d, h, m) def min_to_day_hour_minute_dic(minutes): min_per_day = 24 * 60 d = minutes // min_per_day h = (minut...
def demo1(): i = 1 while i <= 10: print(i) i += 1 print("bye") def demo_for(): for i in range(1, 11): print(i) print("bye") def sum_input(): n = int(input("enter number: ")) total = 0 while n != 0: total += n n = int(input("enter...
import random def demo(): for i in range(100): d1 = random.randint(1, 6) d2 = random.randint(1, 6) d = d1 + d2 print("{:>4}: {} + {} = {:>2}".format(i + 1, d1, d2, d)) demo()
import random flowers = ["lily", "rose", "tulip", "magnolia", "jasmine", "carnation"] b = random.sample(flowers, 3) print(b)
def read_demo1(filename): with open(filename, mode="r") as f: s = f.readlines() print(s) s2 = [line.strip() for line in s] print(s2) def read_demo2(filename): with open(filename, mode="r") as f: s = [line.strip() for line in f] print(s) def read_demo3(filename): ...
from collections import namedtuple def demo1(): x = (4, 7, 8) print("x = ", x) Medal = namedtuple("Medal", ["gold", "silver", "bronze"]) th = Medal(4, 7, 8) print("th = ", th) print(th.gold) print(sum(th[:2])) def demo2(): Medal = namedtuple("Medal", ["country", "gold", "...
from datetime import date from dateutil.relativedelta import relativedelta def how_old_ymd(dob): age = relativedelta(date.today(), dob) print(age) return age.years, age.months, age.days print(date.today()) y, m, d = how_old_ymd(date(1997, 7, 10)) print("{} year {} month {} days".format(y, ...
import random def join_demo(): stations = ("HUA", "SAM", "SIL", "LUM", "KHO", "SIR", "SUK", "PET", "RAM", "CUL", "HUI", "SUT", "RAT", "LAT", "PHA", "CHA", "KAM", "BAN") print(stations) print(" -> ".join(stations)) print(" -> ".join(stations[1:4])) print(" ...
def vin_checkdigit(vin): weight = ( 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ) t = { "A": 1, "B": 2, "C": 3, "D": 4, "E": 5, "F": 6, "G": 7, "H": 8, "J": 1, "K": 2, "L": 3, "M": 4, "N": 5, "P": 7, "R": 9, "S": 2, "T": 3, "U": 4, "V": 5, "W": 6, "X": 7, "Y"...
def demo1(): weight = [70, 60, 48] height = [170, 175, 161] bmi = [] for i in range(len(weight)): bmi.append(weight[i] / (height[i] / 100) ** 2) return bmi def demo2(): weight = [70, 60, 48] height = [170, 175, 161] bmi = [] for w, h in zip(weight, height): ...
def mtable(fromN=2, toN=6): for i in range(1, 13): for j in range(fromN, toN + 1): print("{:2} x {:2} = {:3} | ".format(j, i, j * i), end="") print() if __name__ == '__main__': mtable()
def demo(): print("{}{}".format("th", "Thailand")) print("{:5}|{:15}|".format("th", "Thailand")) print("{:<5}|{:<15}|".format("th", "Thailand")) print("{:>5}|{:>15}|".format("th", "Thailand")) print("{:*>5}|{:->15}|".format("th", "Thailand")) print("{:^5}|{:^15}|".format("th", "Tha...
class User: className = None def __init__(self, name, age): self.name = name self.age = age self.__address = None def __del__(self): print("destructor") @property def address(self): return self.__address @ad...
x = 7 print(float(x)) print(str(x)) print(bool(x)) print(bool(-2)) print(bool(0)) print(int("34"))
import calendar import time print(calendar.weekheader(9) + "\n") print(calendar.month(2020, 4) + "\n") print(calendar.monthcalendar(2020, 4)) print() print(calendar.calendar(2020)) print() print(calendar.weekday(2020, 4, 12)) print() print(calendar.isleap(2020)) print() print(calendar.leapdays(2000,2005)...
precio=int(input("Ingrese el precio: ")) cantidad=int(input("ingrese cantidad")) importe=precio*cantidad print("el importe total es de:") print(importe)
num1=int(input("num 1: ")) num2=int(input("num 2: ")) num3=int(input("num 3: ")) num4=int(input("num 4: ")) suma=num1+num2 producto=num3*num4 print("el resultado de la suma es:") print(suma) print("el resultado del producto es") print(producto)
def Primere(): sound = str(input()) t = "Tiger" s = "Snake" l = "Lion Lion" b = "Bird" i = 1 while i <= 4: i += 1 if sound == "Grr": sound = l elif sound == "Ssss": sound = s elif sound == "Rawr": sound = t elif sound == "Chirp": sound = b print(sound) Primere()
x = int(input()) y = int(input()) if x % y == 0: print('even ',x) else: print('odd',y)
class Solution(object): def arrayStringsAreEqual(self, word1, word2): str1="" str2="" for i in range (0,len(word1)): str1=str1+word1[i] for i in range (0,len(word2)): str2=str2+word2[i] return str1==str2 """ :type word1: List[str] ...
while True: try: isikukood = int(input("Sisesta isikukood")) except ValueError: print ("Isikukood on number!") continue else: break if str(isikukood)[0] in ("1","3","5"): print ("he") elif str(isikukood)[0] > "6": print ("See pole isikukood.") else: ...
class City: def __init__(self, name): self.name = name self.connectedTo = {} def distance(self, city): distance = self.connectedTo[city.name] return distance def __repr__(self): string = str(self.name) + ": (" for key, value in self.connectedTo.items...
def wake_up(day_of_week): if ((day_of_week.lower() == "saturday") or (day_of_week.lower() == "sunday")): return "Go back to bed" else: return "Stop hitting snooze" def commute(weather, mins_until_work): if ((mins_until_work<=10) or (weather.lower()=="rainy")): return "Better take the c...
""" A stack is a linear data structure which follows a particular order in which the operations are performed. The order is last in first out(LIFO). 3 operations: push, pop, top(peak) """ class Stack: def __init__(self): self.items = [] self.head = None self.tail = None def getSize(s...
__author__ = 'florije' if __name__ == '__main__': a = 1 b = 1 c = 300 d = 300 print(a == b, a is b) print(c == d, c is d) ''' In [37]: a = 1 In [38]: b = 1 In [39]: print('a is b', bool(a is b)) ('a is b', True) In [40]: c = 999 In [41]: d = 999 In [42...
class BookShelf: def __init__(self, name): self.bk_sh = {} self.name = name def __str__(self): message = "本棚[{0}]".format(self.name) return message def add_book(self, title, author): self.bk_sh[title] = author print("追加したよ( ̄・ω・ ̄)") def list_...
name = "MS Dhoni" print(name.split()) print(name.split(' '))
''' age = 15 if age == 18: print("Yes") print("Thanks for using code") ''' age = 15 assert age == 18 print("Thanks for using code")
if __name__=='__main__': age = int(input("Enter the age: ")) if age >= 18: print("Eligible") else: print("Not Eligible")
text = "Process Finished With Exit Code 0" result = "" for i in range(len(text)): if text[i].isupper(): result += text[i].lower() elif text[i].islower(): result += text[i].upper() else: result += text[i] print(result) name = "Mr. Karthick BA. BL." ans = "" for c in name: if ...
d={"Name":"John","Class":2,"Rank":1,"FeeStatus":["paid","paid","paid"]} print(d.get("FeeStatus")) print(d["FeeStatus"]) print(d.keys()) print(d.values()) print(d.items()) d.popitem() print(d) d.pop("Class") print(d) del(d["Name"]) print(d)
if __name__=='__main__': n=6 for i in range(1,n): for k in range(i,n-1): print(' ',end="") for j in range(i): print('*',end="") for j in range(i-1): print('*',end="") print()
sentence = "amazing" ''' li = [] for c in sentence: li.append(c) print(li) ''' li = [c for c in sentence] print(li)
li = [5, 3, 6, 8, 2, 0, 7, 1] li = [i ** 3 for i in li] print(li)
import random array_name = "Registers" register_len = 64 file_len = 32 number_systems = {2 : ["'b", 2], 8 : ["'o", 8], 10 : ["'d", 10], 16 : ["'h", 16]} selected_base = 2 for i in range(file_len): x = array_name + "[" + str(i) + "] <= " + str(register_len) + number_systems[selected_base][0] for j in ran...
import math as m S=2117519.73 xo=2000 EV=m.sqrt(S) Xn=1/2*(xo+(S/xo)) n=0 print("S=",S) print("The exact answer to square root of S is",EV) print("When we use Hero's method, we have:") while EV!=Xn : Xn=1/2*(Xn+(S/Xn)) n+=1 print("X",n,"=",Xn) print("For the number S, the answer is the same that the exact...
termo = int(input('Primeiro termo: ')) razão = int(input('Razão: ')) cont = 0 while cont < 10: print('{}'.format(termo), end='') print(' >> ' if cont < 9 else '', end='') cont += 1 termo += razão
def say_hello(): print("hello chenyong") def greetings(x='good morning'): print(x) say_hello() greetings() greetings("cao ni") a=greetings() def create_a_list(x,y=2,z=3): return [x,y,z] b=create_a_list(1) c=create_a_list(3,3) d=create_a_list(6,7,8) print(b,'\n',c,'\n',d) def traverse_args(*args): for arg in arg...
import numpy.random as random random.seed(42) n_tests=10000 winning_doors=random.randint(0,3,n_tests) change_mind_wins=0 insist_wins=0 for winning_door in winning_doors: first_try=random.randint(0,3) remaining_choices=[i for i in range(3) if i!=first_try] wrong_choices=[i for i in range(3) if i!=winning_door] if f...
""" Created on Sun Apr 5 11:51:27 2020 Code based on: https://towardsdatascience.com/web-scraping-html-tables-with-python-c9baba21059 @author: simon """ import requests import lxml.html as lh import pandas as pd import numpy as np def get_main_table(url): """ Gets a table from url Args: ...
import abc class Abstract(abc.ABC): @abc.abstractmethod def __init__(self, x): self.x = 0 class Queen(Abstract): def __init__(self): self.x = int(input('Введите число от 1 до 9: ')) if self.x >= 1 and self.x <= 3: s =str(input("Введите строку: ")) n...
import math x=int(input("enter a numeric value to find log:")) print (math.log(x)) print (math.log(x,10)) print (math.log10(x))
HeapLeft = lambda i : i*2; HeapRight = lambda i : i*2+1; HeapParent = lambda i : i//2; class Heap: def __init__(self): self.A = []; self.nElements = 0; def Value(self, i): assert((i > 0) and (i <= self.nElements)); return self.A[i-1]['key']; def Swap(self,...
import matplotlib.pyplot as plt import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn import metrics data=pd.read_csv("/home/ai31/Desktop/common/ML/Day3/Questions/city.csv") data=data.as_matrix() x=data[:,[2,3,4,5]] ...
from textblob import Word theword = Word("watch") print(theword.pluralize()) from textblob import Word theword = Word("watches") print(theword.singularize())
def mergeSort(n,array): x = "" if n > 1: mid = n//2 left = array[:mid] right = array[mid:] mergeSort(len(left),left) mergeSort(len(right),right) i=0 j=0 k=0 while i < len(left) and j < len(right): if left[i] ...
dna = str(input("dna string to convert")) rna = dna.replace("T","U") print(rna)
import re file = input("Enter the file: ") read = open(file) summ = 0 for line in read: num = re.findall("[0-9]+", line) for elem in num: elem = int(elem) summ = summ + elem print(summ)
medida = float(input('Qual o valor em metros: ')) cm = float(medida*100) mm = float(medida*1000) km = float(medida/1000) print('{} metros: \n{:.3f} cm \n{:.3f} mm\n{:.3f} km'.format(medida, cm, mm, km)) '''medida = float(input('qual a distancia em metros:')) cm = medida * 100 mm = medida * 1000 km = medida / 1000 pri...
tuple1 = () tuple2 = 'tuple', print(tuple2) tuple3 = 'a','b','c' print(tuple3) a,b,c = tuple3 print(b) a,b = '1','2' print(a,b) a,b = b,a print(a,b)
''' False: False None 0 0.0 '' [] () {} set() others is True ''' ''' == != < <= > >= in ... ''' a = 1 b = 2 if a>b: print("a大于b") else: print("a小于b") print("hello \ world") if (a > b): print("a大于b") elif (a == b): print("a等于b") else: print("a小于b") really = True if really: print("really") whil...
""" Console Text Scroller ~~~~~~~~~~~~~~~~~~~~~ Scroll a text on the console. Don't forget to play with the modifier arguments! :Copyright: 2007-2008 Jochen Kupperschmidt :Date: 31-Aug-2008 :License: MIT_ .. _MIT: http://www.opensource.org/licenses/mit-license.php """ from itertools import cycle from sys import...
import unittest from app.Piglatin import PigLatinConverter """ These tests are for the piglatin converter""" class TestConverter(unittest.TestCase): """This test makes sure that once the first letters are not vowels they are moved to the end""" def test_for_none_vowel(self): self.pig = PigLatinConve...
def pick_doll(board, stk, pick): for layer in board: if layer[pick] != 0: stk.append(layer[pick]) layer[pick] = 0 return def solution(board, moves): answer = 0 stk = [] for pick in moves: pick_doll(board, stk, pick-1) if len(stk) >= 2: ...
from copy import deepcopy class Num: def __init__(self, num): self.num = num def __repr__(self): return str(self.num) a = [1, 2, 3] b = [Num(1), Num(2), Num(3)] a1 = a b1 = b print('할당') a1.append(4) print(a) b1.append(Num(4)) print(b) print() print('얕은 복사') a2 = a[:] b2 = b[:] a2.appe...
from collections import defaultdict def threeNumberSum(array, targetSum): ''' 정렬하고 탐색을 시작하나 아니면 정렬 없이 답을 만들까. two number sum 이면 딕셔너리 만들면 된다. three number sum 이면 이중 루프 돌면서 딕셔너리를 look up 하면 되나? ''' array.sort() cache = defaultdict(lambda: defaultdict(dict)) resul...
from typing import List, Any class Branch: """ 상인이 하루에 선택할 수 있는 경우의 수 입니다. 상인은 매일... - 구매 - 가만히 있거 - 판매 를 할 수 있습니다. """ def __init__(self, money: int, stone: int): self.money = money self.stone = stone def buy(self, price: int) -> "Branch": ...
""" Base functions for computes variances """ import math from typing import List from linear_algebra.vectors import sum_of_squares from statistics.central_tendencies import de_mean def standard_deviation(xs: List[float]) -> float: """ The standard deviation is the square root of the variance """ return math....
import os import csv from statistics import mean file = os.path.join("budget_data.csv") dataSet=[] PL = [] plChange = [] months = 0 netTotal = 0 average = 0.0 with open(file,"r",newline = "") as csvfile: csvreader = csv.reader(csvfile,delimiter =",") for lines in csvreader: dataSet.append(lines) ...
""" f=open("sample.txt",'r') sum=0 count=0 while True: line=f.readline() if not line : break count=count+1 result=int(line) sum=sum+result print(sum) average=sum/count f.close() f=open("result.txt",'w') f.write(str(average)) f.close() """ f=open("sample.txt") lines=f.readlines() f.close() total=0 for line in l...
import numpy as np from Values import * import math costLimit = 8000 useCostLimit = True breakValue = 0 coolingStrategy = "linear" if coolingStrategy == "geometric": breakValue = 0.03 sol = np.random.randint(2, size=20) print(sol) Fitness = calculateCost(sol, True) k = 1 m = 0.5 tk = m*20...
class Employee: amount_increment=1.04 def __init__(self, fname, lname, salary): self.fname = fname self.lname = lname self.salary = salary self.email = fname+"."+lname+"@gamil.com" def fullname(self): return "{} {}".format(self.fname, self.lname) def amount_rise(...
from datetime import datetime print("current datetime ", datetime.now()) now = datetime.now() print("current datetime\n", now.strftime("%Y-%m-%d %H:%M:%S"))
import unittest from calculator_app.calculate import Calculate class TestCalculate(unittest.TestCase): def setUp(self): self.calc = Calculate() def test_add_method_returns_correct_result(self): self.assertEqual(4, self.calc.add(2, 2)) def test_add_method_raises_typeerror_if_not_ints(sel...
print("Exercise # 1:") class Account: def __init__(self, owner, balance): self.owner = owner self.balance = balance def __str__(self): return f"Account owner: {self.owner} \nAccount balance: ${self.balance}" def deposit(self, amount): self.balance += amoun...
def reverse(x: int) -> int: reversed = 0 while x != 0: temp = reversed * 10 + x % 10 if temp / 10 != reversed: return 0 reversed = temp x /= 10 return reversed i = 2**40 print(9646324351 > 2 ** 31 - 1)
for i in range(20,0,-1): print(i)
john_1 = "John" john_2 = "John" print(john_1 == john_2) print(1 != 1) print(99 < 1.1) print(99 > 1.1) print(-32 >= -33) print(123 <= 123)
a = 1 b = [1, 2, 3, 0, 0, "string", "hello"] for element in b: try: print(a / element) except (ZeroDivisionError, TypeError) as error: print("This is an exception {}".format(error))
import sys total = len(sys.argv) - 1 print("Total number of args {}".format(total)) if total > 2: print("Too many arguments") elif total < 2: print("Too less arguments") elif total == 2: print("It's correct") arg1 = int(sys.argv[1]) arg2 = int(sys.argv[2]) if arg1 > arg2: print("...
animals = ["Dog", "Cat", "Fish"] lower_animal = [] fruits = ("apple", "pinnaple", "peach") thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 } print("List of animals ", animals) for animal in animals: fave_animal = input("Enter yor favorite animal from the list: ") if animal =...
class Solution(object): def reverseList(self, head): """ :type head: ListNode :rtype: ListNode """ if head == None or head.next == None: return head p = self.reverseList(head.next) head.next.next = head ...
class Solution: def isPalindrome(self, head: ListNode) -> bool: stack = [] curr = head while (curr): stack.append(curr) curr = curr.next node1 = head while (stack): node2 = stack.pop() ...
from datetime import datetime def match_date(myDate): try: if len(myDate.split(' ')) == 1: try: myDObj = datetime.strptime(myDate, '%d-%b-%Y') return(myDObj) except Exception as ie: print("Error dateo...
card_list = [(3, 'diamonds'), (8, 'clubs')] total = 0 for item in card_list: number = item[0] suit = item[1] print(f'{number} of {suit}') total += number print(f'My total number of points is {total}')
import re import os import sys from typing import List from utils import read_inputfile def read_numbers(input: List[str]) -> List[int]: result = [ int(line) for line in input ] return result def verify_number(number: int, to_consider: List[int]) -> bool: for first in to_consider: for s...
from typing import List import os def read_inputfile(filename: str) -> List[str]: with open("input" + os.path.sep + filename) as f: input = [line.strip() for line in f] return input
import string from helpers import rotate_character, alphabet_position from sys import argv, exit def encrypt(text, rot): '''Encrypts a text based on a pseudo ord circle caesar style''' NewString = "" for character in text: NewChar = rotate_character(character, rot) NewString = NewString + ...
import json from os import name users = [] while True: with open("users.json", "w") as file: json.dump(users,file) name = input("Please enter your name:") age = int(input("please enter age:")) user = {"name": name, "age": age} users.a...
tasks = [] def view_tasks(): print(tasks) while True: print("Please make a choice from the following menu:") print("1 - Add Task") print("2 - Delete Task") print("3 - View all tasks ") print("q to quit") choice = input("Enter Choice:") if choice =...
users=[] while True: first = input("Enter first name:") last = input("Enter last name:") user = {"first" : first, "last": last} users.append(user) choice = input("Enter q to quit or any key to continue:") if choice == "q": break print(users)
import simplegui width = 300 hight = 200 font_size = 48 seconds = 0 success = 0 stoped = 0 running = False def format(t): if t >= 6000: return "Boommmmmm!" d = t%10 remains = t//10 bc = remains%60 a = remains//60 if bc < 10: string = string = str(a) + ":0" + str(bc) + "." +...
import turtle def draw_spiral(t,n,sz,ang): for i in range(n): t.right(ang) t.forward(sz) sz = sz + 5 wn = turtle.Screen() tess = turtle.Turtle() wn.bgcolor("lightgreen") tess.color("blue") tess.pensize(3) draw_spiral(tess,99,5,89) tess.right(90)
"""What is the result of 10**3?""" print("The result of 10**3 is: ") print(10 ** 3) print()
""" Write a Python program to multiplies all the items in a list""" total=1 list1 = [11, 5, 17, 18, 23] for ele in range(0, len(list1)): total = total * list1[ele] print("product of all elements in given list: ", total)
""" find the factorial of a number using functions""" def factorial(n): if n == 1: return 1 else: return n * factorial(n - 1) num = int(input('enter the number')) print(factorial)
"""takes a number as a parameter and check the number is prime or not""" def is_prime(num): for i in range(2, num): if num % i == 0: return False return True print('Start') val = int(input('Enter the number to check prime:\n')) ans = is_prime(val) if ans: print(val,...
"""display the Fibonacci series between 0 and 50""" disp = 0 a = 1 series = [] while disp <= 50: series.append(disp) temp = disp disp = disp + a a = temp print(series)
"""Write a Python program to get the smallest number from a list.""" list1 = [10, 20, 4, 45, 99] print("smallest element is:", min(list1))