blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
bba2f1b61f41dc9c2b84db20ce231719af536870 | anupjungkarki/IWAcademy-Assignment | /Assignment 1/DataTypes/answer9.py | 245 | 4.375 | 4 | # Write a Python program to change a given string to a new string where the first and last chars have been exchanged.
def change_string(str):
return str[-1:] + str[1:-1] + str[:1]
str = input("Enter the string:")
print(change_string(str))
|
a754f0d7f896f9300b6a60f40be1083c7a15db38 | anupjungkarki/IWAcademy-Assignment | /Assignment 1/Function/answer5.py | 478 | 4.53125 | 5 | # Write a Python function to calculate the factorial of a number (a non-negative integer). The function accepts
# the number as an argument.
def factorial(num):
if num == 1:
return num
else:
return num * factorial(num - 1)
num = int(input("Enter the number to calculate factorial :"))
if num < ... |
6cf95fb5dd503d20a51596dfd6e19f80d301aa5e | anupjungkarki/IWAcademy-Assignment | /Assignment 2/answer15.py | 1,021 | 4.1875 | 4 | # Imagine you are designing a banking application. What would a customer look like? What attributes would she have?
# What methods would she have?
class BankingCustomer:
# A customer in a bank
def __init__(self, account_number, account_holder, opening_balance, account_type):
self.account_number = a... |
60728a6b6812ffc9c46430ae805e3dfea6e0c20d | anupjungkarki/IWAcademy-Assignment | /Assignment 1/DataTypes/answer42.py | 164 | 3.953125 | 4 | # Write a Python program to convert a list to a tuple.
list_data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(list_data)
tuple_data = tuple(list_data)
print(tuple_data)
|
de19704243cd5e9742b6f18e71e453e95c1f0a01 | anupjungkarki/IWAcademy-Assignment | /Assignment 2/answer12.py | 344 | 4.28125 | 4 | # Create a function, is_palindrome, to determine if a supplied word is the same if the letters are reversed.
def is_palindrome(str):
revers = ''.join(reversed(str))
if str == revers:
return True
else:
return False
str = 'anna'
res = is_palindrome(str)
if res:
print('Yes')
... |
4ed21d2cf3f51c3801be76087de5ec36e637de01 | anupjungkarki/IWAcademy-Assignment | /Assignment 1/DataTypes/answer4.py | 491 | 3.96875 | 4 | # Write a Python program to get a single string from two given strings,
# separated by a space and swap the first two characters of each string.
string1 = 'abc'
string2 = 'xyz'
x = string1[0:2]
y = string2[0:2]
string1 = string1.replace(x, y)
string2 = string2.replace(y, x)
print(string1, string2)
# or we ca also do i... |
b4033c135a3ab0082c2fca1c2f2c6bdbbe55a1e7 | anupjungkarki/IWAcademy-Assignment | /Assignment 1/DataTypes/answer19.py | 352 | 4.25 | 4 | # Write a Python program to get the smallest number from a list.
def smallest_number(list_data):
smaller_number = list_data[0]
for data in list_data:
if data < smaller_number:
smaller_number = data
return smaller_number
result = smallest_number([10, 2, 4, 5, 7, 1, 4, 12, 11])
print('Th... |
0ed356ae26be7ed3fdd35e245eaaaa5683864958 | anupjungkarki/IWAcademy-Assignment | /Assignment 2/answer9.py | 744 | 4.15625 | 4 | # Write a binary search function. It should take a sorted sequence and the item it is looking for. It should return the
# index of the item if found. It should return -1 if the item is not found.
def binary_search(list, element):
low = 0
high = len(list) - 1
mid = 0
while low <= high:
m... |
2f4b42a630fab25900f3e5467c4da144bbbd4ebb | josephjoju2/shell-scripts | /new/dict/ex1.py | 395 | 3.984375 | 4 | spam={'bob': 'dec1', 'tom': 'apr3'}
while True:
print ('enter the name: (blank to quit)')
name=input()
if name=='':
break
elif name in spam:
print(spam[name]+' is the bday of '+name)
else:
print('name not found \nenter the bday of '+name+': ')
bday=input()
sp... |
7e4f0524c8410b6e07a04194ef930208f14d0048 | LoganReinke/ITSE-1329-Python | /CC1/CC1-Ex09/code.py | 181 | 4.03125 | 4 | hours = input("Enter hours: ") #your code goes here
rate = input("Enter rate: ") #your code goes here
pay = int(hours) * int(rate)
print ("Pay: ", float(pay)) # Add your code below |
bbb4fd051d4659adace94d3ab420ddda48b4c505 | LoganReinke/ITSE-1329-Python | /Chatbot/chatbot-phase2-loganreinke.py | 760 | 3.984375 | 4 | #Logan Reinke
greetings = 0
while True:
first_name = input("What is your first name? ")
last_name = input("What is your last name? ")
time = input("What time of day is it (Morning, Afternoon, Evening): ")
if time == "morning":
print("Have a good breakfast " + first_name + " " + last_name[0])
... |
8e9354aebf7b8d5a4a5d90a4a5cf1db0fdd818de | VishwasKashyap/hello-world | /birthdays.py | 469 | 4.15625 | 4 | birthdays = {'yogesh':'Apr 1', 'Sumesh':'May1','Nikhil':'June1'}
while True:
print("Enter a name:(Blank to quit)")
name = input()
if(name == ''):
break
if name in birthdays:
print(birthdays[name] + ' is the day ' + name +' was born')
else:
print("I do not have info about " + ... |
4933c8cabc4643d3a39f9e60ee8828468095ea32 | VishwasKashyap/hello-world | /mypets.py | 175 | 3.84375 | 4 | mypets = ['chiltu','zynga','pooka']
print("Enter your pet's name!")
petName = str(input())
if petName in mypets:
print("you got it right!")
else:
print("go away!!!")
|
3fb21c24727bf9760ad6da70b2e9de329e44a6da | gunesugur/python_solutions | /is_it_an_armstrong_number.py | 255 | 4 | 4 | inputt = input("Enter a number : ")
result = 0
for i in range(len(inputt)):
result = result + int(inputt[i]) ** len(inputt)
if result == int(inputt):
print("This is an Armstrong number...")
else:
print("This is not an Armstrong number...")
|
5e6b9cf3efeda9774ef8460dff7c0d4d26189429 | Stellupo/JetBrainsAcademyPython | /AnimalsWrittingFile.py | 433 | 3.8125 | 4 | file = open("animals.txt", "r")
animals_new = open("animals_new.txt", "w")
for animal in animals:
animal = animal.replace("\n", " ")
animals_new.write(animal)
file.close()
animals_new.close()
# รฉnoncรฉ
'''The file animals.txt has a list of animals, each written on a new line.
For example:
rabbit
cat
turtle
Crea... |
a872926abdcc8596c99730d11f5d694da96dc4fb | dikshant99/stone_paper_scissors | /Stone_Paper_Game.py | 3,111 | 3.984375 | 4 | # Snake water gun
import random
lst = ['s', 'p', 'sc']
chance = 5
no_of_chance = 0
computer_point = 0
human_point = 0
print(" \t \t \t \t Stone,Paper,Scissors Game\n \n")
print("s for stone \np for paper \nsc for scissors \n")
# making the game in while
while no_of_chance < chance:
_input = inp... |
1803d19d6f5237445303fe91b4973674377f64ba | Semin-J/Design_Pattern | /1_SOLID/LSP.py | 1,652 | 3.6875 | 4 | # LSP (Liskov Substitution Principle)
# Derived class instance should be able to substitued with Base class(interface) instance
# with no modification of attributes and methods of derived class
class Rectangle:
def __init__(self, width, height):
# _var: convention, treat it as a private / need more explana... |
1c5c7bb00e91a85552497134fd18cb60fad0a85d | aftrodrigues2/grafos_agm_prim | /python_coisas_legais.py | 991 | 4.53125 | 5 | my_list = range(1,5)
List comprehension
'cria outra lista a partir de um mรฉtodo passado pelos valores de uma lista'
# Output: [1, 4, 9, 16]
[x**2 for x in my_list]
Iterator:
# object with 2 magic methods:'
""" Create the iterator object """
def __iter__(self):
return self
""" make and return the next something ( ... |
c4e8796d4826cdd644df86c0d059fe7f3564f7d0 | mynamesunpower/hello-python | /e_file_class/Ex06_์์ธ์ฒ๋ฆฌ์ํ์ผ.py | 3,277 | 3.671875 | 4 | """
1. ๋ค์ ์ฝ๋์ ์คํ ๊ฒฐ๊ณผ๋ฅผ ์ฐ์์ค.
try:
for i in range(1, 7):
result = 7 // i
print(result)
except ZeroDivisionError:
print("Not divided by 0")
finally:
print("์ข
๋ฃ๋์์ต๋๋ค.")
7
3
2
1
1
1
์ข
๋ฃ๋์์ต๋๋ค
2. ๋ค์ ์ฝ๋๋ฅผ ์คํํ์ ๋, ๊ฐ์ฅ ๋ง์ง๋ง์ ์ถ๋ ฅ๋๋ ๊ฐ์? 5
sentence = list("Hello Gachon")
while (len(sentence) + 1):
try:
... |
67fa9e19a8a89f7f2aa139cd8294ecccb1e6c900 | mynamesunpower/hello-python | /a_datatype_class/Ex05_date.py | 988 | 4.0625 | 4 | #
# import datetime
# today = datetime.date.today();
# print('today is ', today)
from datetime import date, timedelta
today = date.today()
print('today is ', today)
print('๋
๋ ', today.year)
print('์: ', today.month)
print('์ผ: ', today.day)
# ๋ ์ง ๊ณ์ฐ -> timedelta
# from datetime import timedelta
print('์ด์ ', today + tim... |
8806e640040912f797463402ade7ac4037265903 | mynamesunpower/hello-python | /e_file_class/Ex09_RegEx_pwd.py | 952 | 3.859375 | 4 | """
๋น๋ฐ๋ฒํธ ์์ฑ์ ์ ์ ํฉ์ฑ ์ฒดํฌ
1. ๋น๋ฐ๋ฒํธ์ ๊ธธ์ด๋ 6-10
2. ์ซ์์ ์ํ๋ฒณ์ผ๋ก๋ง ๊ตฌ์ฑ๋์ด์ผ ํจ
3. ๋๋ฌธ์์ ์๋ฌธ์๊ฐ ์์ฌ์ผ ํจ ( ๋๋ฌธ์ 1๊ฐ ์ด์, ์๋ฌธ์ 0๊ฐ ์ด์)
4. ์์ ์กฐ๊ฑด์ ๋ถํฉํ๋ฉด ์๋ชป๋ ์ํฉ์ ์ถ๋ ฅํ๊ณ
์กฐ๊ฑด์ ๋ชจ๋ ๋ง์กฑํ๋ฉด ๊ฐ๋ฅํ ๋น๋ฐ๋ฒํธ์์ ์ถ๋ ฅํ๋ค.
"""
import re
def pwd_check(pwd):
pattern = re.compile(r'[A-Z]+[a-z0-9]{6,10}$')
print('์ผ์น' if pattern.search(pwd) else '์ค... |
96194b58368d487f2375fc014b53e28f085db34e | YitingZhang1997/EECS498_2020_Localization_Project | /PID.py | 1,637 | 3.53125 | 4 | import numpy as np
class PID(object):
def __init__(self, desire, kp = np.array([0, 0, 0]), ki =np.array([0, 0, 0]), kd = np.array([0, 0, 0])):
'''
Input:
desire: a series of desire output
kp: propotional gain for PID, should be size 3X1 for x, y, theta
ki: integration gain f... |
2cbfd5ba6e9d4e182a65953bafa8a02dfae5ecf7 | isuminski/proj-final | /Practice_Files/practice-classInit.py | 802 | 3.5625 | 4 |
class TestClass:
def __init__(self, double=False):
if double != 'True':
self.type = 'Single'
self.populate_123()
else:
self.type = 'Double'
self.populate_123()
def populate_123(self):
if self.type == 'Double':
self.on... |
2f438668b34449f7b955cf0ccb86637e1e292336 | JunheZhang66/GWU_classes | /DATS_6103_DataMining/Class03_classes/Week03_hw.py | 6,491 | 4.46875 | 4 |
############### HW Week03 HW Week03 HW Week03 ###############
# We first continue to complete the grade record that we were working on in class.
#%%
###################################### Q1 ###############################
# let us write a function find_grade(total)
# which will take your course tot... |
6f2699dfa7f11c3278135460678f362f06ab952b | annaliang-web/python_projects | /standardDeviationFormula.py | 1,804 | 4.15625 | 4 | # Purpose: Standard Deviation Calculator Program
# Status: Complete
import math
print();
print('\u231B \u231B \u231B Standard Deviation Formula \u231B \u231B \u231B')
def sd(Num_Elements, Dif_Func): #Standard Deviation Formula
divide = Dif_Func / Num_Elements
return round(math.sqrt(divide), 4) #5.2915
... |
371405845f5d34beeee0e8379f6db97d05933b01 | Rocia/Project_Eulers_Solutions_in_Python | /DiffSOS.py | 486 | 3.84375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 30 04:00:17 2018
@author: rocia
"""
def sumOsqr(n):
sum = 0
for i in range(1,n):
sum = sum + i*i
return sum
def sqrOsum(n):
sum = 0
for i in range(1,n):
sum = sum + i
return sum*sum
def diff(n):
sos , s... |
e2d947a6ed3c0d24f5a92a0c55e2cf0413bd1a09 | lzq100123/CS579-Online-Social-Network-Analysis | /bonus/bonus.py | 936 | 3.609375 | 4 | import networkx as nx
def jaccard_wt(graph, node):
"""
The weighted jaccard score, defined above.
Args:
graph....a networkx graph
node.....a node to score potential new edges for.
Returns:
A list of ((node, ni), score) tuples, representing the
score assigned to edge (node, ni)
... |
7570f1ea76e590599616fa9666117a77375ca854 | PrerithSubramanya/Binary-Search-Tree | /find_element.py | 546 | 3.984375 | 4 | def find_element(initial_node,element):
while initial_node is not None: # when root is not none
if initial_node.get_data() == element: # if the element is found
print("element found", element)
break
elif initial_node.get_data() > element: # search left
initial_... |
694728eff4ea9644bf2fa469e8795973869365c2 | maris205/secondary_structure_detection | /src/word_rank/word_rank_score/normalize.py | 826 | 3.859375 | 4 | #!/usr/bin/env python
#coding=utf-8
import sys
import math
#L2
word_dict_count = {}
word_dict = {}
#ุดสตไฃฌฮช\tฦตฤธสฝ
def initial_dict(filename):
dict_file = open(filename, "r")
l2_sum = 0
for line in dict_file:
sequence = line.strip()
key = sequence.split('\t')[0]
value = float(sequence.... |
756e0b654334013b15386b0202b6beb7769e274a | maris205/secondary_structure_detection | /src/soft_count/get_diff.py | 1,042 | 3.78125 | 4 | #!/usr/bin/env python
#coding=utf-8
import math
import sys
#สตฤฒ
word_dict={}
#ืฐุดสต
def load_dict(dict_file_name):
#ุณสผสต
dict_file = open(dict_file_name, "r")
word_dict_count = {}
for line in dict_file:
sequence = line.strip()
key = sequence.split('\t')[0]
value = float(sequence.spl... |
ad1dfbd68e0343363f9b04a21c0a840090c7a1d5 | italoag/M101P | /Week1/for_loops_dicts.py | 152 | 3.921875 | 4 | people = {'name':'Bob', 'hometown': "Palo Alto", 'favorite_color': 'red'}
for item in people:
if (item == 'favorite_color'):
print people[item]
|
612e25f58d4fdf29bfa9c2643bf48883b8b3b893 | ehsanul18/Datacamp-Courses | /Data_Manipulation_with_pandas/1_Transforming_Data/subsettingRowsByCategoricalVariables.py | 1,412 | 4.40625 | 4 | # Subsetting rows by categorical variables
# Subsetting data based on a categorical variable often involves using the "or" operator (|) to select rows from multiple categories. This can get tedious when you want all states in one of three different regions, for example. Instead, use the .isin() method, which will allow... |
d4c4e2a0d665a80e593b7a731df40a2c4790c6ab | HussainHaris/blotto | /twoPlayer.py | 1,272 | 3.609375 | 4 | import round
import csv
# Colonel Blotto for two players via commandline
# only compares two strategies
print("Welcome to Colonel Blotto")
list_one = [0]
list_two = [0]
while True:
try:
first_combo = input("\nPlease enter player one's combination: Ex) 20 20 20 20 20 0 0 0 0 0 \n")
list_one = list... |
beb2cc36a985f740a629c8eade58b2251c711ada | well-that-sucks/AIB_Lab3 | /algorithms.py | 6,972 | 3.53125 | 4 | from collections import deque as queue
class Algoritms:
def return_min(self, res1, res2):
if (res1[0] <= res2[0]):
return res1
return res2
def retrieve_shortest_path(self, maze, pos, target, path_matrix):
d_row = [-1, 0, 1, 0]
d_col = [0, 1, 0, -1]
... |
cc0782259f752b375e343cb73db942f653538930 | Vitalik5588/LITS-HomeWork | /exercise_4.py | 1,299 | 3.546875 | 4 | ''' ะะฐะดะฐัะฐ โ4
ะ ะพะทัะพะฑะธัะธ ััะฝะบััั *counter(a, b)*,
ัะบะฐ ะฟัะธะนะผะฐั 2 ะฐัะณัะผะตะฝัะธ -- *ััะปั ะฝะตะฒัะดโัะผะฝั ัะธัะปะฐ a ัะฐ b*,
ัะฐ ะฟะพะฒะตััะฐั ัะธัะปะพ -- ะบัะปัะบัััั ััะทะฝะธั
ัะธัั ัะธัะปะฐ b, ัะบั ะผัััััััั ั ัะธัะปั ะฐ.
*ะะฐะฟัะธะบะปะฐะด*
ะะธะบะปะธะบ ััะฝะบััั: _counter(12345, 567)_
ะะพะฒะตััะฐั: *1*
ะะธะบะปะธะบ ััะฝะบััั: _counter(1233211, 12128)_
ะะพะฒะตััะฐั: *2*
ะะธะบะปะธะบ ััะฝะบั... |
6e5180cdeac9e948734601c391442be97579e7ab | Leigan0/python_challenges | /fibonacci/app/fib_checker.py | 164 | 3.53125 | 4 | from fibonacci import FibonacciChecker
import argparse
i = input('Please enter a number ')
fib_checker = FibonacciChecker(i)
print('sum =')
print(fib_checker.sum()) |
ebe9520072518f693880085eb8149de596449f61 | shuuji3/competitive-programming | /aizu-online-judge/ITP1_9_A/main.py | 189 | 3.921875 | 4 | word = input()
count = 0
while True:
line = input()
if line == 'END_OF_TEXT':
break
count += len(list(filter(lambda s: s.lower() == word, line.split())))
print(count)
|
d9ce84d48cbb80f0c7bd3d95c7817402bb812e9c | shuuji3/competitive-programming | /aizu-online-judge/ITP1_11_A/main.py | 1,176 | 3.734375 | 4 | class Dice:
def __init__(self, top, front, right, left, back, bottom):
self.top = top
self.front = front
self.right = right
self.left = left
self.back = back
self.bottom = bottom
def print_top(self):
print(self.top)
def roll(self, direction):
... |
db6ade12d089ebfd5d44e2f5d3d4b7df55388098 | SushmitaJadhav23/OOP-Python | /2.py | 762 | 3.796875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 3 03:09:38 2020
@author: sush1
"""
# class, method, attribute, object
class Hobbies:
def __init__(self, name):
self.name = name
h1 = Hobbies("Chicken Gravy")
h2 = Hobbies("Indian serials")
print(h1.name)
print(h2.name)
# differ... |
b971cc325c6e80cccae00aacbb6a08432c6b0852 | nnelluri928/DailyByte | /remove_middile_node.py | 584 | 4.03125 | 4 | '''
This question is asked by Amazon.
Given a non-empty linked list,
return the middle node of the list. If the linked list contains an
even number of elements, return the node closer to the end.
1->2->3->null, return 2
1->2->3->4->null, return 3
1->null, return 1
'''
class Solution:
def middleNode(self, head... |
1a9cc6aaff9150598592226180d02a1777fb227b | nnelluri928/DailyByte | /detectcapital.py | 564 | 4.0625 | 4 | #!/usr/bin/env python3
def detectCapitalUse(s):
return s.isupper() or s.islower() or s.istitle()
print(detectCapitalUse("USA"))
print(detectCapitalUse("Calvin"))
print(detectCapitalUse("compUter"))
print(detectCapitalUse("coding"))
def detectCapitalUse1(s):
if s.upper() == s:
return True
elif s.lower() == s:
... |
4da3eb739d4b04cbf8cab795f713002cc892c35d | nnelluri928/DailyByte | /spot_difference.py | 1,052 | 3.9375 | 4 | '''
This question is asked by Google. You are given two strings, s and t which only consist of lowercase letters. i
t is generated by shuffling the letters in s as well as potentially adding an additional random character.
Return the letter that was randomly added to t if it exists, otherwise, return โ โ.
Note: You ma... |
80d1fae8f9e85b3f6872e329b8f18b8ed722a192 | uth27/analysis-trans | /negation.py | 306 | 3.9375 | 4 | negation_words = ['not', 'no']
positive_words = ['good', 'nice']
your_string = "This is not good"
list_of_words = your_string.split()
for neg_word in negation_words:
if neg_word in list_of_words:
next_word = list_of_words[list_of_words.index(neg_word) + 1]
print(next_word)
print("negatif") |
e92750e8bf0bca889775696c88951dedece352f0 | wpine215/python-ref | /multithreading/semaphore.py | 1,720 | 3.609375 | 4 | import random, time
from threading import BoundedSemaphore, Thread
# Initialize the maximum items/connections for the semaphore
max_items = 5
# Initialize bounded semaphore object to variable 'container'
container = BoundedSemaphore(max_items)
def randsleep():
time.sleep(random.randrange(2, 5))
def producer(n):
"... |
3938914b8bb030e7d827ed654662a7da01266d22 | kritikadusad/CrackingTheCodingInterview | /StringsandLists/question3.py | 722 | 4.28125 | 4 | """
URLify: Write a method to replace all spaces in a string with '%20'.
You may assume that the string has sufficient space at the end to hold
the additional characters, and that you are given the 'true' length
of the string.
Example:
>>> URLify("Mr John Smith ", 13)
'Mr%20John%20Smith'
"""
def URLify(astri... |
f9a4b4e8b5a9f34a8153191b7dc36bee79941fdb | kritikadusad/CrackingTheCodingInterview | /LinkedLists/question6.py | 1,951 | 4.34375 | 4 | """ Question 2.6: Implement a function to check if a linked list
is a palindrome.
Tests:
>>> ll1 = Node(1, Node(2, Node(2, Node(1)))) # 1->2->2->1
>>> ll1.isPalindrome()
True
>>> ll1 = Node(1, Node(2, Node(3, Node(2, Node(1))))) # 1->2->3->2->1
>>> ll1.isPalindrome()
True
>>> ll1 = Node... |
45861bce3be7223104453003da59e1c7ac9aa2a4 | MattForshaw/PyIntro | /the_syntax.py | 1,863 | 3.953125 | 4 | """ Example of Python Syntax """
#pylint: disable=invalid-name,simplifiable-if-statement
print("Hello World!")
x = 10
y = 15
print(x + y)
# Creating lists (arrays) of things is easy
list_of_things = [1, 2, 3, 4, 5]
# Python (unlike other, lesser languages) indexes from zero
print(list_of_things[0])
# For loops ... |
03c2971e5a84e2cba226849134e5c98997b704b3 | Routashirbad/PRACTICE-PYTHON-EXERCISES | /4.py | 882 | 4.375 | 4 | """
Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number,
then tell them whether they guessed too low, too high, or exactly right. (Hint: remember to use the user input lessons from the very first exercise)
Extras:
Keep the game going until the user types โexitโ
Keep track of... |
0997072ac648ace03b2a16537094d386bf6afa39 | Routashirbad/PRACTICE-PYTHON-EXERCISES | /5.py | 737 | 4.34375 | 4 | """
Take two lists, say for example these two:
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
and write a program that returns a list that contains only the elements that are common between the lists (without duplicates).
Make sure your program works on two lists of diffe... |
9addf76b861a257326749b588ebc8db69a563d68 | acoconut/adventOfCode2015 | /dec02/puzzle2.py | 415 | 3.703125 | 4 | #!/usr/bin/python3
# Advent of code
# Day 2 - Part 2
# Read and parse input
fo = open("input.txt", "r+")
lines = fo.readlines()
total = 0
for present in lines:
sizes = present.split('x')
int_sizes = [ int(x) for x in sizes ]
int_sizes = sorted(int_sizes)
total = total + int_sizes[0] + int_sizes[0... |
abff7b6f357c89791e177cdbda784e6a5df65c4e | Virendra-Das/PythonProjects | /add.py | 271 | 3.984375 | 4 | num1= input("Enter first number")
num2= input("Enter second number")
res = int(num1) + int(num2)
print("Sum is %s" % res)
print("Type 2")
num1= int(input("Enter first number"))
num2= input("Enter second number")
res = num1 + int(num2)
print("Sum is %s" % res) |
3e5cdc548e4cc2bdad07944b719c4b06bc46c226 | katharine-ruoxi/EulerProject | /EulerProject2.py | 480 | 3.640625 | 4 | # 002
'''
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued term... |
1345c7d06f1812de2c2b6964df4cf4f3c941e1eb | praneetk96/FibonacciSeries | /main.py | 621 | 4.25 | 4 | # ____ _ __
# | _ \| |/ / Praneet Kumar
# | |_) | ' / https://github.com/praneetk96
# | __/| . \
# |_| |_|\_\
# Fibonacci series generator for the 100th place using recursion in python3
# for i.e. enter 100 to get fibonacci series till 100th place!
nterms = int(input("Enter number's place till to print the ser... |
364aca6e73f17dcf44c94dc13c06d8c37df0991a | AmberHsia94/Scary_Leetcode | /ๅๅไธบkไธช็ธ็ญ็ๅญ้.py | 1,797 | 3.578125 | 4 | # coding=utf-8
# ็ปๅฎไธไธชๆดๆฐๆฐ็ป nums ๅไธไธชๆญฃๆดๆฐ k๏ผๆพๅบๆฏๅฆๆๅฏ่ฝๆ่ฟไธชๆฐ็ปๅๆ k ไธช้็ฉบๅญ้๏ผๅ
ถๆปๅ้ฝ็ธ็ญใ
# ่พๅ
ฅ๏ผ nums = [4, 3, 2, 3, 5, 2, 1], k = 4
# ่พๅบ๏ผ True
# ่ฏดๆ๏ผ ๆๅฏ่ฝๅฐๅ
ถๅๆ 4 ไธชๅญ้๏ผ5๏ผ๏ผ๏ผ1,4๏ผ๏ผ๏ผ2,3๏ผ๏ผ๏ผ2,3๏ผ็ญไบๆปๅใ
# 1 <= k <= len(nums) <= 16
# 0 < nums[i] < 10000
# ้ๅฝๆฅๅ๏ผ1. ๆฑๅบๆฐ็ป็ๆๆๆฐๅญไนๅsum๏ผๅคๆญsumๆฏๅฆ่ฝๆด้คk๏ผไธ่ฝๆด้ค็่ฏ็ดๆฅ่ฟๅfalseใ
# 2. ้่ฆไธไธชvisitedๆฐ็ปๆฅ่ฎฐๅฝๅชไบๆฐ็ปๅทฒ็ป่ขซ้ไธญไบ๏ผ็ถๅ่ฐ็จ้ๅฝๅฝๆฐ๏ผ
... |
55ffc29c8b34397447fa3451f8bec3975cad1952 | AmberHsia94/Scary_Leetcode | /remove_duplicate.py | 1,596 | 3.90625 | 4 | # coding=utf-8
# Given a sorted array,
# such that each element appear only once and return the new length.
# Do not allocate extra space for another array, you must do this in place with constant memory.
# ่ฟ้ขๅ ไธบๆฏๆๅบๅฅฝ็๏ผๅ
ณ้ฎ็นๆฏ"ๅ ้คๅคไฝๅ
็ด "๏ผ่ฟ้ๅ
ถๅฎไธๆฏ็็ๅ ้ค๏ผๅ ไธบ้ข็ฎ่ฆๆฑไธ่ฝ็จ้ขๅค็็ฉบ้ด๏ผๆไปฅๆๅฅฝ็ๆ่ทฏๆฏๆฟๆขใ
# ้ข็ฎไน่ฏดไบโIt doesn't matter what you leave beyond the ... |
5a7a957d415bd78a0f496bf753b38037187b29b5 | AmberHsia94/Scary_Leetcode | /264_UglyNumberII.py | 2,120 | 4.34375 | 4 | # coding=utf-8
# Write a program to find the n-th ugly number.
# Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.
# ๆไปฌๆๅชๅ
ๅซๅ ๅญ 2ใ3 ๅ 5 ็ๆฐ็งฐไฝไธๆฐ
#
# Example:
# Input: n = 10
# Output: 12
# Explanation: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ugly numbers.
# Note:
# 1 is typ... |
0f8d79636f431bc10b283ee532913d02801395e5 | djemma01/Projects | /TopTrumps.py | 2,700 | 3.875 | 4 | #####################################################################################################
# Pokemon Project
# Authors: Daisy Matthews, Ellie Watts, Dzhemma Ruseva
# Since: 27th of March
#####################################################################################################
# imported li... |
a01073ae88f05f859d0d7e9305b5450949fd0b61 | sethips/udacity | /cs212-Design-of-Computer-Programs/final-5.py | 14,014 | 4.40625 | 4 | # Unit 5: Probability in the game of Darts
"""
In the game of darts, players throw darts at a board to score points.
The circular board has a 'bulls-eye' in the center and 20 slices
called sections, numbered 1 to 20, radiating out from the bulls-eye.
The board is also divided into concentric rings. The bulls-eye has
... |
4f18835d8347b0d7e921916f0bd40b6a9b79c35d | sethips/udacity | /cs101-Introduction-to-Computer-Science/hw3.1.py | 102 | 3.546875 | 4 | #!/usr/bin/python2.6
p = [1, 0, 1]
p[0] = p[0]+p[1]
p[1]=p[0]+p[2]
p[2]=p[0]+p[1]
print p == [1,2,3]
|
9f463d651946eb2da538df850adef95ecc78bc5c | sethips/udacity | /cs212-Design-of-Computer-Programs/final-1.py | 3,481 | 4.28125 | 4 | """
UNIT 1: Bowling:
You will write the function bowling(balls), which returns an integer indicating
the score of a ten-pin bowling game. balls is a list of integers indicating
how many pins are knocked down with each ball. For example, a perfect game of
bowling would be described with:
>>> bowling([10, 10, 10,... |
7d25c2f40f2984b59c042f01370118f8e14eae11 | sethips/udacity | /cs101-Introduction-to-Computer-Science/hw3.3.py | 200 | 3.609375 | 4 | #!/usr/bin/python2.6
def product_list(l):
if len(l)<1:
return None
r = 1.
for i in l:
r *= i;
return r
print product_list([9])
print product_list([1,2,3,4])
|
5cd6755913aa9d01ade506436863aa28bb11d19b | nl900/Mars-Rover-technical-Challenge | /Python/mars_rover/rover.py | 1,922 | 3.65625 | 4 | """
Contains Rover and Squad classes
"""
class Rover(object):
"""
Represent individual rovers
Attributes:
x coordinate
y coordinate
direction facing
invalid_move: whether the move would push rover off plateau
"""
rotation = {'L': {'N':'W', 'W':'S', 'S':'E','E':'... |
f28597e068f7be153a7d9266cdc2c2d8f8707dbd | djvaughn/CodeAbbey | /averageOfArray.py | 558 | 3.90625 | 4 | import math
numOfValues = int(input())
answer = []
def getSize(array):
return len(array) - 1
def getSum(array):
sumValue = 0
for value in array:
sumValue += int(value)
return sumValue
def rounding(number):
decimal = number % 1
if decimal > .5:
number = math.ceil(number)
el... |
f938a5823290aca28a9a69c6462fa44dfe1eb951 | djvaughn/CodeAbbey | /airthmeticProgression.py | 275 | 3.734375 | 4 | numOfValues = int(input())
answer = []
for i in range(0, numOfValues):
a, b, n= input().split()
a = int(a)
b = int(b)
n = int(n)
arithSum = 0
for i in range(0, n):
arithSum = arithSum + (a + (i*b))
answer.append(arithSum)
print(*answer)
|
27dcd4c1acabbbce6b6734163834d326a8e30c1f | djvaughn/CodeAbbey | /squareRoot.py | 288 | 3.609375 | 4 | numOfValues = int(input())
answer = []
for i in range(numOfValues):
x, n = input().split()
x = int(x)
n = int(n)
if n is 0:
answer.append(1)
else:
r = 1
for i in range(n):
r = (r + (x/r))/2
answer.append(r)
print(*answer)
|
c306a702832c52f2fd1308378c9e3cd6bcb0bf12 | frodr33/airbnb-helper | /machine-learning/query_yelp.py | 7,153 | 3.71875 | 4 | # -*- coding: utf-8 -*-
"""
This program demonstrates the capability of the Yelp Fusion API
by using the Search API to query for businesses by a search term and location,
and the Business API to query additional information about the top result
from the search query.
Please refer to http://www.yelp.com/developers/v3/d... |
9c984009bae088118868c610797fdaa65c66f3e4 | Manhal2050/python-excercise | /QUESTION5.py | 613 | 4.4375 | 4 | L=['Network' , 'Math' , 'Programming', 'Physics' , 'Music']
max = 'Network'
for i in L:
if len(i) > len(max):
max = i
print("The Longest word is: ", max)
#This program defines an array containing several words and its task is to find the longest word, where in the beginning the first word... |
de9edfcb61006426597cc9e98978ddee36ee8e60 | pagakarthik/attalos | /attalos/imgtxt_algorithms/correlation/correlation.py | 5,612 | 3.65625 | 4 | import numpy as np
def construct_W(w2v_model, vocab, dtype=np.float64):
"""
Creates and returns a numpy ndarray of dimensions (200 x size(vocab)).
The nth column in this array represents the Word2Vec vector for the nth word in vocab.
Words in vocab not in the vocabulary for w2v_model will be ignored/s... |
1c9161106d4f128a4b550eb6af3d12720d494fbb | CarolCebin/TPA-Ordenacao | /src/utils/csv.py | 378 | 3.5625 | 4 | import csv
def readFile(fileName, skipHeader):
with open(fileName, 'r') as csvfile:
#Skip Header
if skipHeader:
next(csvfile)
list = []
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
list.append(row)
#
#
return list
#... |
e3f3c5746f2a5f57d97fa56bc5dbf880b8c226c0 | jobi-k/japi.py | /examples/ai/simpleai/helloworld.py | 1,236 | 4.28125 | 4 | # This example is from the simpleai library document available at
# http://simpleai.readthedocs.io/en/latest/#installation and written
# in my own personal format to assist with understanding.
# The example itself attempts to create the string HELLO WORLD using
# the A* algorthim(pronounced "A star". Used most common... |
348119d0bfb69f803c564026a6ef7f4375f04a30 | yoshiscythe/proj1 | /tower_make.py | 445 | 3.5 | 4 | def tower_make(cup_goal_set, stage):
cup_diameter = 0.08
cup_height = 0.096
cup_list =[]
for i in range(stage, 0, -1):
tmp = cup_goal_set[0]+cup_diameter*(i-1)/2
for j in range(i):
cup_list.append([tmp-cup_diameter*j, cup_goal_set[1],cup_goal_set[2]+cup_height*(stage-i)])
return cup_list
... |
93a24704eabf535699e873e17e83d0882d28ad08 | smu095/presentations | /python101/scripts/variable_hints.py | 193 | 3.90625 | 4 | from typing import Dict, List, Tuple
list_ex: List[int] = [1, 2, "3", 4]
tuple_ex: Tuple[int, int, str] = (2, 3, "four")
dict_ex: Dict[str, int] = {"three": 3}
dict_ex[:2]
dict_ex[2] = "two"
|
0a7c81fa179b5d7055d08c9b42eb2337a66009b9 | rowbot1/learnpython | /practicepython/Character_Input.py | 977 | 4.0625 | 4 | """
https://www.practicepython.org/exercise/2014/01/29/01-character-input.html
Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 years old.
"""
name = input("What is your name: ")
# make input an integer
age =... |
d2dc5a5ea93da71c9aa94bc053b484e3bbc332ca | rowbot1/learnpython | /practicepython/String_Lists.py | 462 | 4.1875 | 4 | """
https://www.practicepython.org/exercise/2014/03/12/06-string-lists.html
"""
word = input("Enter Word to test if it is a palindrome: ")
# start at all of the word ':', stop at all of the word ':'
# https://stackoverflow.com/questions/31633635/what-is-the-meaning-of-inta-1-in-python
# the -1 translates to len(word)-... |
94161f9de85d70c78e24dc68608baa47e5e716a5 | acoder1983/leetcode | /util.py | 2,228 | 3.734375 | 4 | class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def list_new(arr):
next = head = ListNode(0)
for a in arr:
next.next = ListNode(a)
next = next.next
return head.next
def list_equal(lst1, lst2):
while lst1 is not None and lst2 i... |
e98a18b45526da557dadefb554cb94e43d6c9249 | acoder1983/leetcode | /406-recon-queue.py | 2,489 | 3.546875 | 4 | import time
class Solution:
# def reconstructQueue(self, people):
# """
# :type people: List[List[int]]
# :rtype: List[List[int]]
# """
# i = 0
# while i < len(people):
# next_i = self.setInQueue(i, people)
# # print(people, i, ne... |
09fe7052cbcefbb2f417a2d94926ab950adb279a | abalcorin/DevNet_vCC_assignments | /abalcorin_DevNet_vCC_Team0_Camp1_Day2_assign1_Assignment_01.py | 734 | 3.9375 | 4 | """
Programmability Black Belt Apprentice (Level1)
https://github.com/Devanampriya/DevNet_vCC_Team0/blob/master/Camp1_Day2_assign1
Participant: ALBREN ALCORIN
Assignment
Write a program (in Python 3) to print โI have attended ------ sessions!!โ from the below variable dataset containing sessionIDs
Sessions_Attended = ... |
8001a245788bc457c241caeec98961ec631c6d93 | Deipied/coding_puzzles | /find_min_sorted_array.py | 1,155 | 3.921875 | 4 | # Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:
# [4,5,6,7,0,1,2] if it was rotated 4 times.
# [0,1,2,4,5,6,7] if it was rotated 7 times.
# Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results... |
e0be63174c843399899aceac8904bc89a7ea3ff9 | mjmonarch/Hangman1 | /Hangman/task/hangman/hangman.py | 5,281 | 4.0625 | 4 | # ---------------------------3---------------------------
# import random
#
# words = ['python', 'java', 'kotlin', 'javascript']
# word_needed = random.choice(words)
#
# print("Guess the word:")
# word_input = input()
# if word_needed == word_input:
# print("You survived!")
# else:
# print("You are hanged!")
#... |
37cbb74935c2576d8671c2163a90a1bc817543c1 | adi037raj/AI-programs-2 | /Code section/Problem 3.1 Lazy_magneto_VI.py | 8,228 | 3.546875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 23 10:16:06 2021
@author: AADITYA RAJ BARNWAL
"""
import numpy as np
import random
REWARD = 0 # constant reward for non-terminal states
DISCOUNT = 0.85 #given this question
MAX_ERROR = 10**(-3)
NUM_ROW = 5
NUM_COL = 5
c1=[3,4] # uses 0 based indexing
... |
d0328c10c80ff2619ad51553d4e887f9c50f2228 | GrissomGilbert/Project-Euler-solve | /problem_34.py | 953 | 3.859375 | 4 | '''
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to the sum of the factorial of their digits.
Note: as 1! = 1 and 2! = 2 are not sums they are not included.
'''
from _functools import reduce
from time import time
def is_curious(num,pro_dict):
tmp=num
... |
d759a41ae2e2fdc3835175681a08f4a016cf8242 | GrissomGilbert/Project-Euler-solve | /problem_21.py | 1,244 | 3.921875 | 4 | '''
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
If d(a) = b and d(b) = a, where a != b, then a and b are an amicable pair and each of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110;... |
416dd9bd2ea494222a68eefe447788c6ed551dd6 | billmei/conway-python | /game_of_life.py | 6,496 | 4.1875 | 4 | #!/usr/bin/env python3
"""
Conway's Game of life implementation in Python.
Grid is a torus, i.e. cells on the edges wrap around to the other side.
"""
from __future__ import print_function
import os.path
import sys
def main():
use_stdout = False
if '-m' in sys.argv:
if sys.argv[-1] == 'test':
... |
6ea21065cadc01d9df2aad712a974d7c9145b6df | SomayehRK/SomayehRazaghi_python_project | /Users.py | 3,536 | 3.78125 | 4 | import csv
from os import path
from pathlib import Path
from hashing import hash_pass
class Users:
def __init__(self, access_level, username, password, name, phone_number):
"""
:param access_level: user's access level : admin or customer
:param username: user's username
:param pass... |
b62b36c608aa3aaa4003e9cec85875865cf4bc77 | xinghuZhou/huhu | /Dd.py | 307 | 3.515625 | 4 | class Dd:
def __init__(self,name):
print('ๅๅงๅๆนๆณ')
self.name=name
def eat(self):
print("%s็ฑๅ้ชจๅคดๆฑค"%self.name)
tom=Dd('tom')
tom.eat()
jack=Dd('jack')
jack.eat()
|
eaa00029506daaf6e9ba862f26ade67afea5259e | xinghuZhou/huhu | /4.py | 126 | 3.578125 | 4 | S1={'a','b','c','1','2','3'}
S2={'c','d','e','f','3','4','5','6'}
print(S1 & S2)
print(S1 | S2)
print(S1 - S2)
print(S1 ^ S2)
|
9a773a894ad292ab79f14d5ae5418ad72638f5a6 | xinghuZhou/huhu | /StringNum.py | 441 | 3.5 | 4 | def StringNum():
digitnum,alphanum = 0,0
a = input('่ฏท่พๅ
ฅไธไธฒๅญ็ฌฆ๏ผ')
for i in a:
if i.isdigit():
digitnum+=1;
elif i.isalpha():
alphanum+=1
else:
print("่ฏฅๅญ็ฌฆไธฒไธญๅซๆ้ๆฐๅญๆๅญๆฏ๏ผ็ป่ฎก็ปๆ้่ฏฏ.")
break
return (digitnum,alphanum)
s = StringNum()
print('ๆฐๅญไธชๆฐ๏ผ... |
947b19823aa02e78f8e3f6906dec7d52bfb297d3 | xinghuZhou/huhu | /1.py | 584 | 3.71875 | 4 | L1 = ['ๅไบฌ','ไธๆตท','ๅคฉๆดฅ','ๆตๅ','้ๅท','ๅ่ฅ','ๅไบฌ','ๆญๅท']
print(len(L1))
L1.append('็ฆๅท')
print(L1)
L1.insert(3,'ๅคชๅ')
print(L1)
L1[2]='็ณๅฎถๅบ'
print(L1)
L1.remove('ไธๆตท')
print(L1)
s = L1.pop(0)
print(s)
print(L1)print(s)
print(L1)print(s)
print(L1)
print(s)
print(L1)
s = L1.index('้ๅท')
print(s)
print(L1[0:5])
print(L1[:6])
print(L1[5:... |
da3aef6f52712e4c0f3fabbc634183c11e650517 | jdeffo/PasswordManager | /V2.py | 593 | 3.890625 | 4 | #! /usr/bin/env python3
import sys, pyperclip
PASSWORDS = { }
def passwords_read():
global PASSWORDS
with open("passwords.txt") as f:
for line in f:
(key, value) = line.split()
PASSWORDS[key] = value
f.close()
if len(sys.argv) < 2:
print("Usage: Python V1.py [account]... |
0f361a94806615dc91dc51508bf48a4efed10c9f | zopcuk/TKG | /threadstop.py | 602 | 4.0625 | 4 | # Python program showing
# how to kill threads
# using set/reset stop
# flag
import threading
import time
def run():
while True:
print('thread running')
global stop_threads
if stop_threads:
print("stop")
break
stop_threads = False
t1 = threading.Thread(target=run... |
70df7c487cbc9eca73664188b3188fbf4c6ce3f6 | reims/wesen | /src/Wesen/sources/Scanner/main.py | 1,016 | 3.71875 | 4 | """
the scanner is a simple wesen, running over the screen like a scanner, eating and reproducing.
"""
from ...defaultwesensource import DefaultWesenSource
class WesenSource(DefaultWesenSource):
def __init__(self, infoAllSource):
"""Do all initialization stuff."""
DefaultWesenSource.__init__(sel... |
062a9cc31aa63bea8c464c413a3c8222d6c95bb2 | eray995/Ex_Files_NumPy_Data_EssT | /gui_application/starter.py | 259 | 4.21875 | 4 | from tkinter import *
root=Tk()
#label Widget
myLabel = Label(root,text="Hello World!")
myLabel2 = Label(root,text="My name is Aylin.")
#Shoving it onto the screen
myLabel.pack()
myLabel.grid(row=0,column=0)
myLabel2.grid(row=1,column=5)
root.mainloop()
|
02c194fd5a88ef379ab560edc1b7e52674307f15 | jamesbond007dj/math-series | /series.py | 678 | 3.84375 | 4 | def fibonacci(n):
if n < 0:
raise ValueError('numbers smaller than zero can not be used')
if n == 1:
return 0
if n == 2:
return 1
else:
return fibonacci(n-1)+fibonacci(n-2)
def lucas(n):
if n < 0:
raise ValueError('numbers smaller than zero can not be used'... |
7cc27554243dbf38e97b905a1cf8b7d83d7fbbe3 | NASA-AMMOS/MMGIS | /private/api/great_circle_calculator/compass.py | 14,531 | 3.71875 | 4 | # -*- coding: utf-8 -*-
# This collection of classes just let me call something like compass.east to get 90 degrees.
from collections import namedtuple
class CompassSimple:
""" A class to use one of the 32 compass points inplace of degrees. This was made so I could just call
compass.east to get 90 degrees.
... |
fac465476c987c11071d45b1c87bd742cefa5ef1 | Teed21/Excel_Planner | /ExcelPlanner.py | 13,714 | 3.515625 | 4 | # Written and Developed by: Tyler Wright
# Date started: 02/05/2019
# Date when workable: 03/21/2019
# Last Updated: 04/26/2019
"""
This class file is meant to operate as a median between ExcelReader and ExcelWriter.
It will handle multiple CP values, instead of handling simply one run-through. It wil... |
f332fbdbcef4f5efbabc4344107374620f268dc6 | hsuan81/SOP-book | /ch11/mapIt.py | 564 | 3.921875 | 4 | #! //anaconda3/bin/python3
# ๆญค็บ็จๅผ่
ณๆฌscript
# to operate the script, we must write the path of the interpreter (type โwhich python3โ to obtain the address in terminal)
# mapIt.py (launches a map in the browser using an address from the command line or clipboard.)
import webbrowser, sys, pyperclip
if len(sys.argv) > 1:
... |
f3ba74a6055a120f6b84139fa8dbd10aca7da2cd | python-kurs/exercise-1-Liederj | /first_steps.py | 1,106 | 4.21875 | 4 | # Exercise 1
# Answers to questions that ask for non-code answers can simply be added as comments.
# 1) The following line causes a SyntaxError. Please correct the line so that it's output is 'Hallo Welt!' [1P]
print(Hallo Welt!)
# 2) Calculate the difference between a and b and assign the result to a variable called... |
fadd1a7d66ccae733891f2b1e10bc3d272af1b14 | ericachang018/CodeChallenges | /staircase.py | 453 | 4.1875 | 4 | # input is an int
# output is a staircase of #
# Staircase to the left output:
#
##
###
####
#####
######
def staircase_to_right(nums):
steps = range(0,nums +1)
print steps
for x in steps:
print "#" * x
def staircase_to_left(nums):
steps = range(1, nums + 1)
print steps
for x in steps:
sp... |
b8ccf256fad66bd92e2dc1b6195c43c0ad31623b | metaperspective/CS101 | /frequency_analysis.py | 460 | 3.578125 | 4 | def freq_analysis(message):
freq_list = [0] * 26
for char in message:
for i in range(0,26):
if char == chr(i + 97):
freq_list[i] += (1. / len(message))
##
# Your code here
##
return freq_list
anal = freq_analysis('this has been a test')
letters = ['a'] * 26
f... |
3ac89b344bfc80d82cc1526d13b0106c8d96adb9 | r2101hul/REGRESSION-MODELS | /Linear Regression.py | 1,059 | 3.5 | 4 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 1 10:43:41 2018
@author: Rahul
"""
#Importing the Library
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
#Get the dataset
dataset=pd.read_csv('weight-height.csv')
x=dataset.iloc[:,1:2].values
y=dataset.iloc[:,2].values
#Devide data into train... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.