text
stringlengths
37
1.41M
a=int(input()) a=str(a) f=0 for i in range(0,len(a)): if(a[i]=='0' or a[i]=='1'): f=1 else: f=0 break if(f==1): print("yes") else: print("no")
in1=int(input()) in2=0 while(in1>0): in3=in1%10 in2=in2*10+in3 in1=in1//10 print(in2)
a = input() b = ["a","e","i","o","u","A","E","I","O","U"] c=len(a) for i in range(0,c): if(a[i] in b): print("yes") break else: print("no")
a = int(input()) if (a>=0): if (a%2==0): print("Even") elif (a%1==0): print("Odd") else: print("invalid")
# userConverstionType = input("1: inches to mm. 2: or mm to inches. Q to quit. ") # converstionTypeInt = int(userConverstionType) # userNumber = input("Enter number: ") # userNumberFloat = float(userNumber) # 1 would convert in to mm # TODO loop to be able to process multiple calculations # TODO add function to impro...
''' Python中有join()和os.path.join()两个函数,具体作用如下: join():连接字符串数组。 将字符串、元组、列表中的元素以指定的字符(分隔符)连接生成一个新的字符串 os.path.join():将多个路径组合后返回 1、join()函数 语法:'sep'.join(seq) 参数说明 sep:分隔符。可以为空 seq:要连接的元素序列、字符串、元组、字典 上面的语法即:以sep作为分隔符,将seq所有的元素合并成一个新的字符串(ps:开头和结尾不会有sep,即seq元素之间由sep来拼接) 返回值:返回一个以分隔符sep连接各个元素后生成的字符串 2、...
 ''' 撰寫一程式可供使用者輸入一整數N a.假如(N < 60)印出"不及格" b.假如(N≥60)而且(N < 90)印出"及格" c.假如(N≥90)而且(N < 100)印出"表現優異" ''' if __name__ == "__main__": text = raw_input("enter:") print text n1 = int(text) if n1 < 60: print u"不及格" elif n1 >= 60 and n1 < 90: print u"及格" elif n1 >= 90 and n1 <= 100: print u"表現優異" ...
import tkinter win=tkinter.Tk(); win.title("登录"); win.geometry("200x80"); L1=tkinter.Label(win,text="用户名:",width=6); L1.place(x=1,y=1); L2=tkinter.Label(win,text="密码:",width=6); L2.place(x=1,y=20); E1=tkinter.Entry(win,width=20); E1.place(x=45,y=1); E2=tkinter.Entry(win,width=20,show="哈"); E2.place(x=45,y=20); B1=tkint...
list1=['鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪']; list2=['鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪']; print([m+n for m in list1 for n in list2 if m!=n]);
import tkinter win=tkinter.Tk();#创建一个窗口 win.title('pack几何布局'); win.geometry("800x600");#设置窗口的大小 labe1=tkinter.Label(win,text='hello,python');#创建Label组件 labe1.pack();#组件label的位置设置书40-41页图1-10 button1=tkinter.Button(win,text='BUTTON1');#创建Button组件 button1.pack(side=tkinter.LEFT);#将button1组件添加到窗口中显示,左停靠 button2=tk...
import math def nCr(n, r): # Implements the combinatorics n choose r r = min(r, n-r) numer = 1 demon = 1 while(r >= 1): numer *= (n-r+1) demon *= r r -= 1 return(int(numer/demon)) #try to help user to find upperbound by example def upperBound(s, t): ...
# this module make socket server with listening port and accept connection and decode responses from socket import * import random import os import time import handle_request class MakeServer(): ''' Template for Server object''' def __init__(self,port=8080): self.port=port self.host='127.0.0.1' self.sock_obj...
from tkinter import * from tkinter import filedialog as tkFileDialog #from tkFileDialog import askopenfilename import numpy as np from utils import * def NewFile(root): for k, ele in enumerate(root.winfo_children()): if k>0: ele.destroy() print ("New File!... (not implemented)") return ...
# -*- coding: utf-8 -*- """ Created on Wed Nov 4 10:51:10 2020 Minimum Height Trees Intuition: eat away the leaf nodes until only one or two nodes are remaining. The max number of min height trees is 2. The leaf nodes can never be part of a min height tree if more than 2 nodes. Think about it like a physical tree w...
count = 0; increasing = True; amp = 10; dc = 1; graph = ""; while True: for i in range(0,count): if count==amp and i == count-1: graph = graph + "*"; elif increasing: graph = graph + "\\"; elif not increasing: graph = graph + "/"; print(graph); gr...
# A program to check if the number is positive or negative # PRE-REQUISITES # 0 is neither positive or negative # Let's tart with creating the find number is +ve or -ve or 0 def posORneg(num): if (num == "q"): return "Invalid or not Real" elif (num > 0): return "Positive" elif (num < 0): ...
class InvalidValues(Exception): pass def compare(str1, str2): '''compare strings. params: str1 -- string version 1 str2 -- string version 2 the strings are a dot seperated integers. return: 1 if str1 = str2 0 if str1 > str1 -1 if str1 < str2 raise invalidValues exception...
""" https://realpython.com/python-sockets/#handling-multiple-connections https://docs.python.org/3/howto/sockets.html Now we come to the major stumbling block of sockets - send and recv operate on the network buffers. They do not necessarily handle all the bytes you hand them (or expect from them), because their majo...
# https://snarky.ca/how-the-heck-does-async-await-work-in-python-3-5/ # Let's summarize all of this into simpler terms. Defining a method with async # def makes it a coroutine. The other way to make a coroutine is to flag a # generator with types.coroutine -- technically the flag is the # CO_ITERABLE_COROUTINE flag on...
#!/usr/bin/python # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt class RidgeRegressor(object): """ Linear Least Squares Regression with Tikhonov regularization. More simply called Ridge Regression. We wish to fit our model so both the least squares residuals and L2 norm ...
import json # Encoding data and writing in json file car_data = {"Name" : "Renault", "Country" : "France"} # Dictionary # Testing code for i in enumerate(car_data.items()): print(i) print(car_data.get("Name")) # Finding out data type print(type(car_data)) # Creating JSON object- json.dumps changes python dict to...
import time import random print('*'*65) print('Hullo, hullo. I am Magic Eight Ball. Ask me anything!') print() question = input('What would you like to know? ') time.sleep(0.7) print('Shaking!') time.sleep(0.7) print("I'm thinking...") time.sleep(0.7) print("I'm still thinking...") time.sleep(0.7) choice = random.ra...
def bestSum(target, array, memo={}): if target==0: return [] if target<0: return None try: return memo[target] except KeyError: shortest_combination = None for number in array: reminder=target-number reminder_result=bestSum(reminder,array, memo) if (reminder_result) is not None: ...
n = int(input()) capacity = 255 for i in range(n): liters = int(input()) if liters <= capacity: capacity -= liters else: print("Insufficient capacity!") print(255-capacity)
text = input().split() total = 0 sum_total = 0 for word in text: number = int(word[1:-1]) if word[0].isupper(): total = number / (ord(word[0]) - 64) else: total = number * (ord(word[0]) - 96) if word[-1].isupper(): total -= (ord(word[-1]) - 64) else: total += (ord(wo...
energy = 100 coins = 100 events = input().split("|") is_closed = False for event in events: event_list = event.split("-") name = event_list[0] num = int(event_list[1]) if name == "rest": if energy + num >= 100: print(f"You gained {100-energy} energy.") energy = 100 ...
text = input().split() first = text[0] second = text[1] total = 0 i = 0 while i < min(len(first), len(second)): total += ord(first[i]) * ord(second[i]) i += 1 if len(first) > len(second): while i < len(first): total += ord(first[i]) i += 1 elif len(second) > len(first): while i < len(se...
resources = {} command = input() while command != "stop": value = int(input()) if command not in resources: resources[command] = value else: resources[command] += value command = input() for key, value in resources.items(): print(f"{key} -> {value}")
fires = input().split("#") water = int(input()) cells = [] effort = 0 for fire in fires: individual_fire = fire.split(" = ") if (individual_fire[0] == "High" and 81 <= int(individual_fire[1]) <= 125) or (individual_fire[0] == "Medium" and 51 <= int(individual_fire[1]) <= 80) or (individual_fire[0] == "Low" and...
def palindrome(list1): for num in list1: n = len(num) half = n // 2 is_palindrome = True for i in range(half): if num[i] != num[-(i+1)]: is_palindrome = False if is_palindrome: print("True") else: print("False") my...
quantity = int(input()) days = int(input()) i = 0 spirit = 0 budget = 0 count_days = days while count_days > 0: i += 1 if i % 11 == 0: quantity += 2 if i % 2 == 0: budget += quantity * 2 spirit += 5 if i % 3 == 0: budget += quantity*8 spirit += 13 if i % 5 ==...
command = input() courses = {} while command != "end": course_name, student_name = command.split(" : ") if course_name not in courses: courses[course_name] = {"count": 0, "names": []} courses[course_name]["names"].append(student_name) courses[course_name]["count"] += 1 command = input() cour...
command = input() participants = {} languages = {} while command != "exam finished": command_list = command.split("-") username = command_list[0] if command_list[1] == "banned": del participants[username] else: language = command_list[1] points = int(command_list[2]) if ...
numbers = input().split(", ") numbers_int = [int(x) for x in numbers] d = 0 collection = [] while numbers_int: collection.clear() d += 10 for i in numbers_int: if i <= d: collection.append(i) for j in collection: numbers_int.remove(j) print(f"Group of {d}'...
num_people = int(input("how many people are there ")) num_pizza = input("how many pizzas are there ") slices_per_pizza = int(input("how many slices are there ")) cost_per_pizza = float(input("how much does each pizza cost ")) total_slices = num_pizza * slices_per_pizza slices_per_person = total_slices / num_people pr...
import datetime class Activity(object): ''' This class represents an activity event created from 2 sensor_logs ''' daytime_start = datetime.time(6, 30) daytime_end = datetime.time(21, 30) def __init__(self, uuid=None, start_datetime=None, end_datetime=None, start_log=None, end_log=None): ...
""" This is an example of singleton in Python""" import threading import factory_method as fm from abc import ABC class PetCache(ABC): """Represents the cache for pets """ current_instance = None lock = threading.Lock() def __init__(self): self.items = dict() super().__init__() ...
import turtle as t colors = [ "orange" , "red" , "pink" , "yellow" , "blue" , "green" ,"purple" , "brown"] for x in range (360): t.pencolor(colors[x % 8]) t.width(x / 5 + 1 ) t.forward(x) t.left(20)
# Pythono3 code to rename multiple # files in a directory or folder # importing os module import os # Function to rename multiple files def main(): i = 0 parent_dir = os.getcwd() j = 1 dir_name = 'C:/Users/kumar_vaibhav/PycharmProjects/Object_Detection/Images/' for filename in os.listdir...
import random while True: print("make your choice:") choice = input() choice = choice.lower() print("my choice is:", choice) choices = ['rock','paper','scissors'] computerChoice = random.choice(choices) print("computer choice is:", computerChoice) choiceDict = {'rock': 0, 'pape...
import numpy as np import pandas as pd import matplotlib.pyplot as plt #sigmoid function def sigmoid(z): return 1/(1+np.exp(-z)) #finding the gradient of the cost function at given weights def grad(x,y,t): m=y.size gradient = np.transpose(1/m*np.matmul(np.transpose(sigmoid(np.matmul(x,t))-y),x)) return gradient ...
def listToString(s): # initialize an empty string str1 = " " # return string return (str1.join(s)) # Driver code str1 = " " s = ['Geeks', 'for', 'Geeks'] print(str1.join(s))
# Given an array of integers, find the pair of adjacent elements that has the largest product and return that product. def adjacentElementsProduct(inputArray): # initializing i i = 0 # create a variable and setting it to the product of the first pair maxSoFar = inputArray[i] * inputArray[i+1] # lo...
# Ammon S Mugimu # Uber Career Prep 2019 # Assignment-1 # Question 1. # Time complexity: O(M + N) # Space complexity O(M) def isStringPermution(s1, s2): if not s1 or not s2: return False elif type(s1) != str or type(s2) != str or len(s1) != len(s2): return False char_dict = dict() #...
#!/usr/bin/python3 #Capiturar dois niumetoas no teminal # e escrever a soma dos dos # Se o numero resultante da soma for maior que 100 # Escrever: "Que numero grandao...." #Caso conrtrario: "Que numero pequeno....." # Se o numero for igual a 50, escrever "....." texto_grotesco = 'Por conseguinte, o novo modelo es...
#Give clues (unknown) secret_word = "giraffe" guess = "" guess_count = 0 guess_limit = 3 out_of_guesses = False print("Guess the Word!\nYou get 3 guesses. Good luck!\n") while guess != secret_word and not(out_of_guesses): if guess_count < guess_limit: guess = input("Enter guess: ") guess_count += 1...
r = 'S' c = 0 while r == 'S': n = int(input('Digite um valor: ')) r = str(input('Quer continuar? [S/N]: ')).upper() c = c +1 print('Houve {} repetições.'.format(c-1)) print('Fim')
print('{:-^40}'.format('LOJA SUPER BARATÃO')) precoT = maior1000 = menorpreco = cont = 0 barato = ' ' while True: prod = str(input('Nome do Produto: ')).upper().strip() preco = float(input('Preço R$ ')) cont += 1 precoT += preco if preco > 1000: maior1000 += 1 '''if cont == 1: m...
n1 = int(input('um Valor: ')) n2 = int(input('Outro Valor: ')) s = n1 + n2 m = n1 * n2 d = n1 / n2 di = n1 // n2 e = n1 ** n2 sb = n1 - n2 rest = n1 % n2 print('A soma é: {}, a multiplicação é: {}, a divisão é: {:.3f}'.format(s,m,d), end=' ') print('Divisão inteira é: {}, a Exponenciação é: {}, a Subtração é: {}, e o r...
from random import randint from time import sleep rdpc = randint(1, 10) nm = 0 cont = 0 print('-=-' * 20) print('Vou pensar em um número entre 1 e 10. Tente descobrir...') print('-=-' * 20) print(rdpc) while nm != rdpc: nm = int(input('Em qual número eu pensei? ')) print('PROCESSANDO...') sleep(0.3) con...
cont = 0 soma = 0 while True: nm = int(input(f'Digite o {cont+1}º número: ')) if nm == 999: break cont += 1 soma += nm print(f'Foram lançados {cont} números, totalizando {soma}')
n1 = float(input('Digite a primeira nota: ')) n2 = float(input('Digite a segunda nota: ')) n3 = float(input('Digite a terceira nota: ')) media = (n1 + n2 + n3)/3 print('A sua média é: {:.2f}'.format(media)) print('PARABÉNS, VOCÊ VOI APROVADO!' if media >= 7 else 'REPROVADO, ESTUDE MAIS!')
nome = str(input('Qual o seu nome: ')).lower if nome == 'Jesus Cristo': print('É o filho de Deus, o todo poderoso, o quem pertence toda honra e toda glória!') else: print('Aceite Jesus Cristo como Senhor e Salvador, e serás Salvo!')
sx = str(input('Digite o seu sexo [M/F]: ')).strip().upper()[0] while sx not in 'MnFf': sx = str(input('Dados inválidos. Por favor, informe seu sexo: ')).strip().upper()[0] print('Sexo {} registrado com sucesso'.format(sx))
frase = 'Jesus Cristo é o meu Senhor, dono e Deus!' print(frase[:13]) print(frase[6:13]) print(frase[1:5:3]) print(frase.count('s')) print(frase.upper().count('N')) print(frase.replace('Jesus', 'Yeshua')) print('Senhor' in frase) print(frase.lower().find('senhor')) div = frase.split() print(div[1][:16])
n = s = 0 while n != 999: n = int(input('Digite um número: ')) s += n print('A soma vale {}'.format(s))
def savePositions(): filename = turtle.textinput("Save turtle positions", "What is the filname you want to create?") newfile = open(filename, "wt") for thisTurtle in allTurtles: #Make a string for one turtle, in the right one_line = str(thisTurtle.xco...
#fibonaci by using generators """def fib(num): a, b = 0, 1 for i in range(0, num): yield "{}: {}".format(i+1, a) a, b = b, a+b for item in fib(12): print(item)""" #generators for listing dictionarz items """myDict = {"throne": "iron", "ass": "huge", "number": "infinite"} for ke...
str = input("Enter a string:\n> ") print(str.lower())
product = "iphone and android phones" lett_d = {} for char in product: if char not in lett_d: lett_d[char] = 0 lett_d[char] = lett_d[char] +1 print(lett_d) ks = lett_d.keys() max_value = list(ks)[0] for k in ks: print(k) if lett_d[k] > lett_d[max_value]: max_value = k prin...
def square(x): return (x * x) def add(x,y): return (x+y) x = 7 y = 7 print(add(square(y), square(x)))
# Dibuja un octagono con una espiral dentro from turtle import * def octagon(tortuga, x, y, color): tortuga.pencolor(color) tortuga.penup() tortuga.setposition(x, y) tortuga.pendown() for i in range(8): tortuga.forward(80) tortuga.right(45) def spiral(tortuga, x, y, color): d...
words ="Why sometimes I have Believed as many as six impossible things before breakfast".split() iterator=iter(words) for v in iterator:# ate the end of the collection StopIterartion exception will be raised print(v) iterator2=iter(words) while iterator2: print(next(iterator2))
words ="Why sometimes I have Believed as many as six impossible things before breakfast".split() # print(words) # x=[len(word) for word in words]#[Expr(item) for item in iterable] # print(x) from math import factorial f=[len(str(factorial(x))) for x in range (1,20)]# returs the list print(f)
#!/d/Python/Python37/python # import sys # print ("Number of arguments:", len(sys.argv), "arguments.") # print ("Argument List:" , str(sys.argv)) # print ("") # print (sys.argv[1]) # print (sys.argv[2]) # Teste datetime import datetime from datetime import date today = date.today() newtoday = today...
# this is an example code comment movie_count = 3 # number of movies I saw last year arbitrary_number = 10 # an arbitrary number # We can use a simple "if else block" to see # if a number if bigger than another if movie_count > arbitrary_number: print("You watched a lot of movies!") else: print("You watched few mov...
""" url: https://www.algoexpert.io/questions/Find%20Three%20Largest%20Numbers notes: easy one :D """ from typing import List class Solution(object): """ class object A data inside xBinaryTree """ def __init__(self, name=None): self.name = name # remember variables used in multiple function...
from users.models import Person def friends(name): """Returns a set of the friends of the given user, in the given graph. """ friends_list = Person.objects.get(name=name).friends.all() return set(friends_list) def friends_of_friends(user): """Returns a set of friends of friends of the given user...
#! /usr/bin/env python # coding: utf-8 one = 3 two = 4 three = 5 four = 4 five = 4 six = 3 seven = 5 eight = 5 nine = 4 ten = 3 eleven = 6 twelve = 6 thirteen = 8 fourteen = 8 fifteen = 7 sixteen = 7 seventeen = 9 eighteen = 8 nineteen = 8 twenty = 6 thirty = 6 forty = 5 fifty = 5 sixty = 5 seventy = 7 eighty = 6 nine...
#!/usr/bin/env python # coding: utf-8 answer = 0 for x in str(2 ** 1000): answer += int(x) print answer
#!/usr/bin/env python # coding: utf-8 from math import sqrt def divisor_generator(n): large_divisors = [] for i in xrange(1, int(sqrt(n) + 1)): if n % i == 0: yield i if i*i != n and n/i != n: large_divisors.append(n / i) for divisor in reversed(large_diviso...
print('You are in Master Branch!') #emoji module from emoji import emojize print(emojize(':angry_face_with_horns:')) f = open('doc.txt', 'r') print(f.read(156)) for line in f: print(line.strip()) f.close() f = open('doc.txt', 'r') print(f.read(156)) for line in f: print(line, end="") f.close() file = open(...
""" Initialize and Reshape the Networks Now to the most interesting part. Here is where we handle the reshaping of each network. Note, this is not an automatic procedure and is unique to each model. Recall, the final layer of a CNN model, which is often times an FC layer, has the same number of nodes as the number of o...
import turtle pen = turtle.Turtle() pen1 = turtle.Turtle() paper = turtle.Screen() pen1.up() pen1.setx(-200) pen1.down() pen.color('brown') for i in range(36): pen.fd(10) pen.right(10) pen1.fd(10) pen1.right(10)
#!/usr/bin/python #Question 1.2 def isPermutation(str1,str2): s1=sorted(str1) s2=sorted(str2) if(s1==s2): return True else: return False if __name__=="__main__": str1 = "fast" str2 = "tasf" print isPermutation(str1,str2)
squares = [1, 4, 9, 16, 25] squares.append(8**8) print(squares) print(squares[:]) for i in range(5,9): print(i) #print(randomRange)
#!/usr/bin/python def special(lst): ones = 0 twos = 0 for x in lst: twos |= ones & x ones ^= x not_threes = ~(ones & twos) ones &= not_threes twos &= not_threes return ones if __name__ == "__main__": # lst = [1, 2, 4, 6, 4, 1, 2, 3, 6, 4, 2, 1, 3, 6] lst = [4,...
costPrice=float(input("enter the cost price ")) sellingPrice=float(input("enter the selling price")) profit=sellingPrice-costPrice print("Profit is ",profit) new_Selling_Price=(105/100)*profit + costPrice print("Adding on 5% profit Selling price is ",new_Selling_Price)
n=int(input('Enter list size:-')) print('Enter elements seprated by space :-') list=list(map(int,input('Enter a elements').split())) for j in range(len(list)-1): list[j]=max(list[j+1:]) print(list)
bread_slices=4 jars_peanutbutter=1 jars_jelly=10 if bread_slices>=2 and jars_peanutbutter>=1 and jars_jelly>=1: print "I'm hungry, let's make a sandwich! We can make {0} sandwiches to share or {1} open faced sandwiches.".format(bread_slices/2, bread_slices) elif bread_slices<2 or jars_peanutbutter<1 or jars_jelly<1: ...
class Heap: def __init__(self, lstr=None): self.heap = [] if isinstance(lstr, list): self.heap = lstr self.buildheap() def __repr__(self): return " ,".join(str(i) for i in self.heap) def buildheap(self): n = len(self.heap) for i in range(...
""" Check Primality Functions Exercise 11 Ask the user for a number and determine whether the number is prime or not. """ from sys import exit def prime(): number = input( "\nEnter a number to check if it is Prime number.\n" ) if not number: exit(0) try: number = int(number) ...
import cv2 import numpy as np # path to input images are specified and # images are loaded with imread command image1 = cv2.imread('b.png') # cv2.bitwise_not is applied over the # image input with applied parameters dest_not1 = cv2.bitwise_not(image1, mask=None) # the windows showing output image # with the Bitwise ...
# !/usr/bin/python # -*- coding: utf-8 -*- """ __author__ = 'qing.li' """ # 异常捕获 # try: # num = int(input("请输入一个整数:")) # result = 8 / num # print(result) # except ZeroDivisionError: # print("1") # except ValueError: # pass # 错误类型 # 捕获未知错误 # try: # num = int(input("请输入一个整数:")) # result = 8 /...
""" 计算机的硬件组成: 主板 固化(寄存器,是直接和cpu进行交互的一个硬件) CPU 中央处理器:计算(数字计算和逻辑计算)和控制(控制所有硬件协调工作) 存储 硬盘 内存 输入设备 键盘 鼠标 话筒 输出设备 显示器 音响 打印机 早期的计算机是以计算为核心的。现在的计算机是以存储为核心的 计算机的发展过程: 电子管计算机 耗电 体积大 散热量高 晶体管计算机 白色大头计算机 集成电路计算机 大型集成电路计算机: 甚大型集成电路计算机 计算机的操作系统: 操作系统是一个软件,是一个能直接操作硬件的一个软件 微软研发的w...
from multiprocessing import Process import time """ 守护进程: 跟随者父进程的代码执行结束,守护进程就结束 守护进程不允许开启子进程 """ # def func(): # time.sleep(3) # print("this is son") # # # if __name__ == '__main__': # p = Process(target=func) # p.daemon = True # 设置进程为守护进程,必须在start之前设置 # p.start() # # p.join() # time...
import time def func(): print(123) sum = 0 print(333) sum += 1 yield sum print(444) sum += 1 yield sum print(555) sum += 1 yield sum def fff(): g = func() # 并不会开始执行函数 print("this is in fff()") print(next(g)) # 开始执行到yeild 之后 time.sleep(1) print("again...
from abc import ABC, abstractmethod class Unit(ABC): def __init__(self,team: int = 0): self.team = team self.is_alive = True @property @abstractmethod def value(self): """ The worth of each unit i.e. Queen = 9, etc """ raise NotImplementedError ...
print("= = = = = = = = = = = = = = =") print("PROGRAM HITUNG GAJI KARYAWAN") print("PT AMAN SENTOSA") print("= = = = = = = = = = = = = = =") nama = input("Nama Karyawan ") gol = input("Golongan Jabaatan ") pend = input("Pendidikan ") jumlah = int(input("Jumlah Jam Kerja ")) gapok = 300000 ...
deretangka = [[1,2,3],[4,5,6],[7,8,9],0] print("Baris Pertama, Kolom Pertama adalah") print(deretangka[0][0]) print("Baris Pertama, Kolom Kedua adalah") print(deretangka[0][1]) print("Baris Pertama, Kolom Ketiga adalah") print(deretangka[0][2]) print("Baris Ketiga, Kolom Ketiga adalah") print(deretangka[2][2]) print("B...
my_pets = ['alfred', 'tabitha', 'william', 'arla'] uppered_pets = list(map(str.upper, my_pets)) print(uppered_pets)
number = int(input("Enter the number to find its factors: ")) print ("factors are: ") for x in range(1,number+1): if number%x == 0: print(x)
# Write a Python program to Print all factors of number and print if the no is perfect number. num = int(input("Enter a number: ")) factors = [] for x in range(1,num): if num%x == 0: factors.append(x) print ("factors are:", factors) if sum(factors) == num: print ("number:", num, "is a perfect number.")
def testOddEven(num): if num%2 == 0: return "its a even number" else: return "its a odd number" num = int(input("Enter a number to test: ")) print(testOddEven(num))
# 6 - Faça um Programa que leia três números e mostre o maior deles. num1 = int(input("Digite o primeiro número: ")) num2 = int(input("Digite o segundo número: ")) num3 = int(input("Digite o terceiro número: ")) if(num1 > num2 and num1 > num3): print("O maior é: %d" %num1) elif(num2 > num1 and num2 > num3):...
# Faça um Programa que peça a temperatura em graus Fahrenheit, # transforme e mostre a temperatura em graus Celsius. # C = 5 * ((F-32) / 9). temFahrenheit = float(input("Digite a temperatura em Fahrenheit: ")) print("A temperatura em Celsius eh: ", 5 * ((temFahrenheit - 32) / 9), "ºC")
# 7 - Faça um Programa que leia três números e mostre o maior e o menor deles. num1 = int(input("Digite o primeiro número: ")) num2 = int(input("Digite o segundo número: ")) num3 = int(input("Digite o terceiro número: ")) if(num1 > num2 and num1 > num3): print("O maior é: %d" %num1) if(num2 > num3): ...
import time import pandas as pd import numpy as np #define dictionaries and lists for filter parameters CITY_DATA = { 'chicago': 'chicago.csv', 'new york city': 'new_york_city.csv', 'washington': 'washington.csv' } LOCALES = ['chicago', 'new york city', 'washington'] MONTHS = ['january',...
import documentary import game from extender import * class Container: __length = 0 def __init__(self): self.store = [] def print(self): print("Container is store", len(self.store), "movies:") for movie in self.store: movie.print() self.__length = self.__l...
# print("Hello, World!") # first = 9 # second = first + 1 # def add(a, b): # print(a + b) # add(first, second) # """asdsdsd""" # cars = ["audi", "mercedes-benz", "bmw", "volkswagen", "volvo", "seat"] # name = "Sharis" # dumb = False # if name: # print(name) # if name == "Sharis" and not dumb: # ca...