blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
b78ec391ca8bbc6943de24f6b4862c8793e3cc14 | cat-holic/Python-Bigdata | /03_Data Science/2.Analysis/3.Database/2.db_insert_rows.py | 1,218 | 4.375 | 4 | # 목적 : 테이블에 새 레코드셋 삽입하기
import csv
import sqlite3
# Path to and name of a CSV input file
input_file = "csv_files/supplier_data.csv"
con = sqlite3.connect('Suppliers.db')
c = con.cursor()
create_table = """CREATE TABLE IF NOT EXISTS Suppliers(
Supplier_Name VARCHAR(20),
Invoic... | true |
bea0678a341e3fc8bc10aeaa0f3f3ff5cce2eb43 | akash3927/python- | /list.py | 1,454 | 4.375 | 4 | #lists
companies=["mahindra","swarajya","rucha","papl"]
#1
print(companies)
#2
print(companies[0])
#3
print(companies[1])
#4
print(companies[1].title())
#replacing
companies[0]="force"
print(companies)
#adding or appending
companies.append("mahindra")
print(companies)
#removing
del companies[0]
print(... | false |
13712aa9ee6581cdc87c817cb630001117e159b7 | apriantoa917/Python-Latihan-DTS-2019 | /LOOPS/loops - for examples.py | 415 | 4.15625 | 4 | #3.1.2.5 Loops in Python | for
# for range 1 parameter -> jumlah perulangan
for i in range(10) :
print("perulangan ke",i)
print()
# for range 2 parameter -> angka awal perulangan, angka akhir perulangan
a = 1
for i in range(3,10) :
print(i," = perulangan ke",a)
a+=1
print()
# for range 3 parameter ->... | false |
e84ee8da19f091260bef637a5d7104b383f981a5 | apriantoa917/Python-Latihan-DTS-2019 | /LOOPS/loops - pyramid block.py | 366 | 4.28125 | 4 | # 3.1.2.14 LAB: Essentials of the while loop
blocks = int(input("Enter the number of blocks: "))
height = 0
layer = 1
while layer <= blocks:
blocks = blocks - layer #jumlah blok yang disusun pada setiap layer , 1,2,3...
height += 1 #bertambah sesuai pertambahan layer
layer += 1
... | true |
a0eb44d5616b3d273426c5a7397c773a4a558c46 | apriantoa917/Python-Latihan-DTS-2019 | /TUPLES/tuples - example.py | 691 | 4.21875 | 4 | # 4.1.6.1 Tuples and dictionaries
# tuple memiliki konsep sama dengan list, perbedaan mendasar tuple dengan list adalah :
# Tuples
# - tuple menggunakan (), list menggunakan []
# - isi dari tuple tidak dapat dimodifikasi setelah di inisialisasi, tidak dapat ditambah (append) atau hapus (delete)
# - yang dapat dilakuka... | false |
02fc00ec75f78c552b47cf4376c8d655b1012cc6 | apriantoa917/Python-Latihan-DTS-2019 | /LOOPS/loops - the ugly vowel eater.py | 282 | 4.21875 | 4 | # 3.1.2.10 LAB: The continue statement - the Ugly Vowel Eater
userWord = input("Enter the word : ")
userWord = userWord.upper()
for letter in userWord :
if (letter == "A" or letter == "I" or letter == "U" or letter == "E" or letter == "O"):
continue
print(letter) | true |
70320362f2dcf8277c59efd3a1b104fca0c0b784 | 100ballovby/6V_Lesson | /IV_term/05_lesson_2505/01_star_functions.py | 1,387 | 4.3125 | 4 | '''
Чтобы передать функции неограниченное количество элементов,
необходимо использовать звездочки.
*args - список аргументов
**kwargs - список именованных аргументов
На примере задачи. Дан список чисел, длина списка неизвестна,
сложите все числа в списке между собой. Верните сумму.
'''
from random import randint
n =... | false |
c73e20200d1fe03e2746432dc925cc63361fd5a4 | 100ballovby/6V_Lesson | /lesson_2601/task0.py | 753 | 4.3125 | 4 | '''
Task 0.
Систему работы с багажом для аэропорта.
Багаж можно поместить в самолет если:
Его ширина < 90 см;
Его высота < 80 см;
Его глубина < 40 см;
ИЛИ
Ширина + высота + глубина < 160.
'''
w = float(input('Введите ширину багажа: '))
h = float(input('Введите высоту багажа: '))
d = float(input('Введите глубину багаж... | false |
fd09482d05ff8e7a0eebed43f3159153792a5834 | 100ballovby/6V_Lesson | /IV_term/03_lesson_0405/shapes.py | 1,192 | 4.34375 | 4 | '''
Параметры:
1. Черепашка
2. Длина стороны
3. координата х
4. координата у
5. Цвет
'''
def square(t, length, x, y, color='black'):
"""Функция рисования квадрата"""
t.goto(x, y) # переместить черепашку в x, y
t.down() # опустить перо (начать рисовать)
t.color(color) # задать черепашке цвет через п... | false |
83c51994945f1fc21ad3cd97c257143b23604909 | LukaszRams/WorkTimer | /applications/database/tables.py | 1,559 | 4.15625 | 4 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file will store the data for the database queries that will be called to create the database
"""
# Table of how many hours an employee should work per month
class Monthly_working_time:
table_name = "MONTHLY_WORKING_TIME"
data = {
"id": ("integer", "... | true |
c6f55ab676a899e115bda4f5316e408f2710f1bd | Silentsoul04/FTSP_2020 | /Extra Lockdown Tasks/Operators_Python.py | 405 | 4.15625 | 4 | # Operators in Python :-
1) Arithematic
2) Assignement
3) Comparison
4) Logical
5) Membership
6) Identity
7) Bitwise
Ex :-
x = 2
y = 3
print(x+y)
print(x-y)
print(x*y)
print(x/y)
print(x//y)
print(x%y)
print(x**y)
Ex :-
x = 1001
print(x)
x+=9
print(x)
x-=9
print(x)
x*=9
print(x)
Ex :-
==
>
<
>= , <= ,... | false |
928511975d3b85c7be7ed6c11c63ce33078cc5a1 | Silentsoul04/FTSP_2020 | /Python_CD6/reverse.py | 874 | 4.25 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 11:41:04 2020
@author: Rajesh
"""
"""
Name:
Reverse Function
Filename:
reverse.py
Problem Statement:
Define a function reverse() that computes the reversal of a string.
Without using Python's inbuilt function
Take input from User
Sample I... | true |
953ebb6e03cbac2798978798127e144ac2eee85f | Silentsoul04/FTSP_2020 | /Python_CD6/generator.py | 930 | 4.28125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 28 17:46:18 2020
@author: Rajesh
"""
"""
Name:
generator
Filename:
generator.py
Problem Statement:
This program accepts a sequence of comma separated numbers from user
and generates a list and tuple with those numbers.
Data:
Not required
E... | true |
12430ff52d75dee8bae34b58f3a5164d585c4ec9 | Silentsoul04/FTSP_2020 | /Durga OOPs/Nested_Classes_OOPs.py | 2,534 | 4.15625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 15:37:38 2020
@author: Rajesh
"""
Nested Classes :-
--------------
class Person:
def __init__(self):
self.name = 'Forsk Coding School'
self.dob = self.DOB()
def display(self):
print('Name :', self.name)
self.dob.display()
... | false |
7ad064ce2fc4150f351ef3ce360dd3d7230a34f6 | Silentsoul04/FTSP_2020 | /Python_CD6/weeks.py | 2,024 | 4.28125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 22 17:01:28 2020
@author: Rajesh
"""
"""
Name:
weeks
Filename:
weeks.py
Problem Statement:
Write a program that adds missing days to existing tuple of days
Sample Input:
('Monday', 'Wednesday', 'Thursday', 'Saturday')
Sample Output:
('Monday... | true |
ce643b9df8113ce2ea53623aecf9d548398eea7e | Silentsoul04/FTSP_2020 | /Durga Strings Pgms/Words_Str_Reverse.py | 299 | 4.21875 | 4 | # WAP to print the words from string in reverse order and take the input from string.
# s='Learning Python is very easy'
s=input('Enter some string to reverse :')
l=s.split()
print(l)
l1=l[: :-1] # The Output will be in the form of List.
print(l1)
output=' '.join(l1)
s.count(l1)
print(output)
| true |
899db6e84ffad7514dbac57c7da77d04d78acb70 | Silentsoul04/FTSP_2020 | /Python_CD6/pangram.py | 1,480 | 4.3125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 27 17:37:41 2020
@author: Rajesh
"""
"""
Name:
Pangram
Filename:
pangram.py
Problem Statement:
Write a Python function to check whether a string is PANGRAM or not
Take input from User and give the output as PANGRAM or NOT PANGRAM.
Hint:
Pan... | true |
f35d17401b20f52dd943239a2c40cb251fa53d03 | jimkaj/PracticePython | /PP_6.py | 342 | 4.28125 | 4 | #Practice Python Ex 6
# Get string and test if palindrome
word = input("Enter text to test for palindrome-ness: ")
start = 0
end = len(word) - 1
while end > start:
if word[start] != word[end]:
print("That's not a palindrome!")
quit()
start = start + 1
end = end -1
print(word,"... | true |
668b160fffc014a4ef3996338f118fc9d4f1db6a | jimkaj/PracticePython | /PP_9.py | 782 | 4.21875 | 4 | # Practice Python #9
# Generate random number from 1-9, have use guess number
import random
num = random.randrange(1,10,1)
print('I have selected a number between 1 and 9')
print("Type 'exit' to stop playing")
count = 0
while True:
guess = input("What number have I selected? ")
if guess == 'exit':
... | true |
b1dff1aea71ec7ebfec48db1ec029a2a7dd349d2 | artneuronmusic/Exercise2_SoftwareTesting | /app.py | 1,673 | 4.15625 | 4 | from blog import Blog
blogs = dict()
MENU_PROMPT = "Enter 'c' to create a blog, 'l' to list blog, 'r' to read one, 'p' to create a post, 'q' to quit"
POST_TEMPLATE = '''---{}---{}'''
def menu():
print_blogs()
selection = input(MENU_PROMPT)
while selection != 'q':
if selection == 'c':
c... | false |
9749245820a806a3da1f256446398a3558cabc6a | darthlyvading/fibonacci | /fibonacci.py | 369 | 4.25 | 4 | terms = int(input("enter the number of terms "))
n1 = 0
n2 = 1
count = 0
if terms <= 0:
print("terms should be > 0")
elif terms == 1:
print("Fibonacci series of ",terms," is :")
print(n1)
else:
print("Fibonacci series is :")
while count < terms:
print(n1)
total = n1 + n2
... | true |
5c96d7745ba921694275a5369cc4993c6bb5d023 | inmank/SPOJ | /source/AddRev.py | 2,292 | 4.3125 | 4 | '''
Created on Jun 20, 2014
@author: karthik
The Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the ancient plays are tragedies.
Therefore the dramatic advisor of ACM has decided to transfigure some tragedies into comedies.
Obviously, this work is very hard because the basic s... | true |
4c209b1e3be29d2ec8c209911301b5930e3e2017 | mozartfish/Summer_2019_Projects | /Linear Regression Algorithm/best_fit_line_intercept.py | 964 | 4.1875 | 4 | # this program explores writing a simple regression algorithm
# author: Pranav Rajan
# Date: June 10, 2019
from statistics import mean
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
# generate some random scattered data
xs = np.array([1, 2, 3, 4, 5, 6], dtype=np.fl... | false |
c95369771981b2f1a1c73b49a0156ede63aa3675 | ginalamp/Coding_Challenges | /hacker_rank/arrays/min_swaps.py | 1,383 | 4.34375 | 4 | '''
Given an unsorted array with consecutive integers, this program
sorts the array and prints the minimum amount of swaps needed
to sort the array
'''
def main(arr):
'''
@param arr - an array of consecutive integers (unsorted)
@return the minimum amount of swaps needed to sort the giv... | true |
340a802c8c77fdc2c4428926a8a2904fe8a388d0 | chirag111222/Daily_Coding_Problems | /Interview_Portilla/Search/sequential_seach.py | 513 | 4.15625 | 4 |
'''
Python => x in list --> How does it work?
Sequential Search
-----------------
'''
unorder = [4,51,32,1,41,54,13,23,5,2,12,40]
order = sorted(unorder)
def seq_search(arr,t):
found = False
for i in arr:
print(i)
if i == t:
found = True
return found
def ord_seq_search(arr... | true |
d9f9a0c1350d5d68c8e651a6c59b5f6cdd8bfbf1 | chirag111222/Daily_Coding_Problems | /DailyCodingProblem/201_max_path_sum.py | 1,816 | 4.125 | 4 |
'''
You are given an array of arrays of integers, where each array corresponds to a row in a triangle of numbers. For example, [[1], [2, 3], [1, 5, 1]] represents the triangle:
1
2 3
1 5 1
We define a path in the triangle to start at the top and go down one row at a time to an adjacent value,
eventually ending w... | true |
72cbfa9e3e72c688bf1f321b2e23d975f50fba79 | silvium76/coding_nomads_labs | /02_basic_datatypes/1_numbers/02_04_temp.py | 554 | 4.3125 | 4 | '''
Fahrenheit to Celsius:
Write the necessary code to read a degree in Fahrenheit from the console
then convert it to Celsius and print it to the console.
C = (F - 32) * (5 / 9)
Output should read like - "81.32 degrees fahrenheit = 27.4 degrees celsius"
'''
temperature_fahrenheit = int(input("Please enter th... | true |
e1b588a089bfc843ac186549b1763db5e55b70bd | umunusb1/PythonMaterial | /python3/02_Basics/02_String_Operations/f_palindrome_check.py | 621 | 4.46875 | 4 | #!/usr/bin/python3
"""
Purpose: Demonstration of Palindrome check
palindrome strings
dad
mom
Algorithms:
-----------
Step 1: Take the string in run-time and store in a variable
Step 2: Compute the reverse of that string
Step 3: Check whether both the strings are equal or not
Step 4: If equal, pr... | true |
37b61ba736f127ebd0ef05a07a4b92b7311fae76 | umunusb1/PythonMaterial | /python3/03_Language_Components/07_Conditional_Operations/b_number_guessing_game.py | 790 | 4.1875 | 4 | #!/usr/bin/python3
"""
Purpose: Number Guessing Game
"""
LUCKY_NUMBER = 69
given_number = int(input('Enter no. of between 0 & 100:'))
print(f'{LUCKY_NUMBER = }')
print(f'{given_number = }')
# print(f'{given_number == LUCKY_NUMBER =}')
# Method 1
# if given_number == LUCKY_NUMBER:
# print('You Guessed Correctly... | false |
400031d6d94eb77df6188d9ffb0ce00a31ba0ce9 | umunusb1/PythonMaterial | /python2/03_Language_Components/05_Conditional_Operations/leap_year_check.py | 1,282 | 4.40625 | 4 | # Python program to check if the input year is a leap year or not
# year = 2018
# To get year (integer input) from the user
year = int(raw_input('year='))
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print("{0} is a leap year".format(year))
else:
print("... | false |
4bfc733c59848c52302a52b5366704fbedce4c94 | umunusb1/PythonMaterial | /python3/04_Exceptions/13_custom_exceptions.py | 564 | 4.15625 | 4 | #!/usr/bin/python3
"""
Purpose: Using Custom Exceptions
"""
# creating a custom exception
class InvalidAge(Exception):
pass
try:
age = int(input('Enter your age:'))
age = abs(age)
if age < 18:
# raise InvalidAge('You are not eligible for voting')
raise InvalidAge(f'You are short by {18... | true |
e53448ad9ec7cd295a7570fc4e75187533c4c134 | umunusb1/PythonMaterial | /python3/10_Modules/03_argparse/a_arg_parse.py | 1,739 | 4.34375 | 4 | #!/usr/bin/python
"""
Purpose: importance and usage of argparse
"""
# # Method 1: hard- coding
# user_name = 'udhay'
# password = 'udhay@123'
# server_name = 'issadsad.mydomain.in'
# # Method 2: input() - run time
# user_name = input('Enter username:')
# password = input('Enter password:')
# server_name = input('Enter... | true |
f3665f6ae8aca1f6ad4017983ef50d681609809f | umunusb1/PythonMaterial | /python2/13_OOP/Practical/06_OOP.py | 779 | 4.21875 | 4 | #!/usr/bin/python
"""
Purpose: demo of OOP
"""
class Person:
def __init__(self): # constructor method
"""
This is constructor
"""
self.name = '' # instance variables
self.age = 0 # instance variables
def enter_age(self, age): # instance methods
self.age = a... | false |
2a202dd5ba552f4bda62adb4bfc92342d867d895 | umunusb1/PythonMaterial | /python2/04_Collections/01_Lists/02_lists.py | 1,791 | 4.59375 | 5 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
List can be classified as single-dimensional and multi-dimensional.
List is representing using [].
List is a mutable object, which means elements in list can be changed.
It can store asymmetric data types
"""
numbers = [88, 99, 666]
# homogenous
print 'type(numbers)', ty... | true |
7e83632d361b1ef09142d86fb45ec5584f8a12c2 | umunusb1/PythonMaterial | /python2/02_Basics/01_Arithmetic_Operations/c_ArithmeticOperations.py | 1,883 | 4.15625 | 4 | #!/usr/bin/python
"""
Purpose: Demonstration of Arithmetic Operations
"""
# compound operators
# += -= *= /= %=
myNumber = 123
print 'myNumber = ', myNumber
myNumber = myNumber + 1
print 'myNumber = ', myNumber
# In cases, where the same variable is present both the sides, then compound operations are valid
myNum... | false |
f74b9eacbdbf872d13578b2802622482f5cf0f28 | umunusb1/PythonMaterial | /python2/15_Regular_Expressions/re7/f1.py | 274 | 4.1875 | 4 | #!/usr/bin/python
import re
string = raw_input("please enter the name of the string:")
reg = re.compile('^.....$',re.DOTALL)
if reg.match(string):
print "our string is 5 character long - %s" %(reg.match(string).group())
else:
print "our string is not 5 characate long"
| true |
b6330d881e53e6df85ec6e4a3e31822d8166252e | umunusb1/PythonMaterial | /python2/07_Functions/practical/crazy_numbers.py | 832 | 4.65625 | 5 | #!python -u
"""
Purpose: Display the crazy numbers
Crazy number: A number whose digits are when raised to the power of the number of digits in that number and then added and if that sum is equal to the number then it is a crazy number.
Example:
Input: 123
Then, if 1^3 + 2^3 + 3^3 is equal to 123 then it is a crazy n... | true |
e2bc5da0d4ce924d8bb9873a41a663d9b02d9618 | umunusb1/PythonMaterial | /python2/02_Basics/01_Arithmetic_Operations/j_complex_numbers.py | 964 | 4.375 | 4 | #!/usr/bin/python
"""
Purpose: Demonstration of complex numbers
Complex Number = Real Number +/- Imaginary Number
In python, 'j' is used to represent the imaginary number.
"""
num1 = 2 + 3j
print "num1=", num1
print "type(num1)=", type(num1)
print
num2 = 0.0 - 2j
print "num2 = ", num2
print "type(num2) = ", type(nu... | false |
3a9217c4b404d4a2ce236ca58b6fe60534bd0556 | umunusb1/PythonMaterial | /python2/04_Collections/01_Lists/04_list.py | 1,714 | 4.15625 | 4 | #!/usr/bin/python
# -*- coding: utf-8 -*-
mylist1 = [1, 11, 111, 1111]
print 'mylist1 = ', mylist1
print 'type(mylist1) = ', type(mylist1)
print
mylist2 = [2, 22, 222, 2222]
print 'mylist2 = ', mylist2
print 'type(mylist2) = ', type(mylist2)
print
newlist = mylist1 + mylist2
print 'newlist = ', new... | false |
5ab99394f33b39ffeb47139e27ee740d5fc5bb2b | umunusb1/PythonMaterial | /python3/04_Exceptions/02_exceptions_handling.py | 1,363 | 4.1875 | 4 | #!/usr/bin/python3
"""
Purpose: Exception Handling
NOTE: Syntax errors cant be handled by except
"""
# import builtins
# print(dir(builtins))
num1 = 10
# num2 = 20 # IndentationError: unexpected indent
# for i in range(5):
# print(i) # IndentationError: expected an indented block
# 10 / 0 # ZeroDivisionError... | false |
dedb7dacef7ef63861c76784fc7cff84cf8ca616 | umunusb1/PythonMaterial | /python3/10_Modules/09_random/04_random_name_generator.py | 775 | 4.28125 | 4 | from random import choice
def random_name_generator(first, second, x):
"""
Generates random names.
Arguments:
- list of first names
- list of last names
- number of random names
"""
names = []
for i in range(x):
names.append("{0} {1}".format(choice(fi... | true |
8f6d1952edb0858a9f9c9b96c6719a1dd5fcb6d2 | umunusb1/PythonMaterial | /python2/08_Decorators/06_Decorators.py | 941 | 4.59375 | 5 | #!/usr/bin/python
"""
Purpose: decorator example
"""
def addition(num1, num2):
print('function -start ')
result = num1 + num2
print('function - before end')
return result
def multiplication(num1, num2):
print('function -start ')
result = num1 * num2
print('function - before end')
ret... | true |
df4858753ba98281c0dcef4e1cfc795d3e153ae3 | OmishaPatel/Python | /miscalgos/reverse_integer.py | 391 | 4.125 | 4 | import math
def reverse_integer(x):
if x > 0:
x= str(x)
x = x[::-1]
x = int(x)
else:
x = str(-x)
x = x[::-1]
x = -1 * int(x)
if x <= math.pow(2, 31) -1 and x >= math.pow(-2,31):
return x
return 0... | true |
65ad7a18009d3595863f35760e7cc8f0ae78657d | OmishaPatel/Python | /datastructure/linked_list_insertion.py | 1,290 | 4.3125 | 4 | class Node:
def __init__(self,data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def print_list(self):
cur_node = self.head
while cur_node:
print(cur_node.data)
cur_node = cur_node.next
de... | true |
3ba562ff4adaad94267aa9c62fdc1134d40b1910 | ingoglia/python_work | /part1/4.11.py | 326 | 4.1875 | 4 | pizzas = ['anchovy', 'cheese', 'olive']
friend_pizzas = ['anchovy', 'cheese', 'olive']
pizzas.append('mushroom')
friend_pizzas.append('pineapple')
print("My favorite pizzas are:")
for pizza in pizzas:
print(pizza)
print("\nMy friends favorite pizzas are:")
for friend_pizza in friend_pizzas:
print(friend_pizza)
... | false |
3683f4b62501faa80cb0a67e3979cabe0fdc7e54 | ingoglia/python_work | /part1/5.2.py | 1,063 | 4.15625 | 4 | string1 = 'ferret'
string2 = 'mouse'
print('does ferret = mouse?')
print(string1 == string2)
string3 = 'Mouse'
print('is a Mouse a mouse?')
print(string2 == string3)
print('are you sure? Try again')
print(string2 == string3.lower())
print('does 3 = 2?')
print(3 == 2)
print('is 3 > 2?')
print(3 > 2)
print('is 3 >= 2... | true |
ebf65f149efb4a2adc6ff84d1dce2d2f61004ce4 | ingoglia/python_work | /part1/8.8.py | 633 | 4.375 | 4 | def make_album(artist, album, tracks=''):
"""builds a dictionary describing a music album"""
if tracks:
music = {'artist': artist, 'album':album, 'number of tracks':tracks}
else:
music = {'artist': artist, 'album':album}
return music
while True:
print("\nPlease tell me an artist an... | true |
b4a24b3ca29f09229589a58abfa8f0c9c4f3a094 | marcellenoukimi/CS-4308-CPL-Assignment-3 | /Student.py | 2,681 | 4.34375 | 4 | """
Student Name: Marcelle Noukimi
Institution: Kennesaw State University
College: College of Computing and Software Engineering
Department: Department of Computer Science
Professor: Dr. Sarah North
Course Code & Title: CS 4308 Concepts of Programming Languages
Section 01 Fall 2021
Date: Oct... | true |
cd332ab59ede9fa70ac847d4dad76065aa9882a2 | iNouvellie/python-3 | /02_EstructuraDeDatos/06_Diccionario_III.py | 594 | 4.375 | 4 | calificaciones = {"tito": 10, "naty":6, "amaro": 5}
#Al recorrer e imprimir con un for, solo muestra la llave
for calificacion in calificaciones:
print (calificacion)
#De esta forma obtenemos el numero de la calificacion
for calificacion in calificaciones:
print (calificaciones[calificacion])
#Imprime la key, pero... | false |
ebe0471563ed33d4af96c73109a0f83f33332ae4 | iNouvellie/python-3 | /01_IntroduccionPython/07_Ciclos.py | 697 | 4.125 | 4 | #Ciclos while, repiten bloque de codigo mientras la condicion sea cierta
#Ciclo for, recorren elementos en una coleccion
frutas = 10
while frutas > 0:
print ("Estoy comiendo una fruta " + str(frutas))
#frutas = frutas - 1
frutas -= 1
if frutas == 0:
print ("\n")
print ("Me quede sin frutas")
#--- o ---
list... | false |
51e015545046b6411f88bcf969c22b69529464d3 | bigmoletos/WildCodeSchool_France_IOI-Sololearn | /soloearn.python/sololearn_pythpn_takeAshortCut_1.py | 1,353 | 4.375 | 4 | #Quiz sololearn python test take a shortcut 1
#https://www.sololearn.com/Play/Python
#raccouri level1
from _ast import For
x=4
x+=5
print (x)
#*************
print("test 2")
#What does this code do?
for i in range(10):
if not i % 2 == 0:
print(i+1)
#*************
print("test 3")
#What is the output of this c... | true |
d1349d0982af9e06c5e8c5aaa26b200497b22e3f | guokairong123/PythonBase | /DataStructure/list_demo1.py | 663 | 4.1875 | 4 | """
如果我们想生产一个平方列表,比如 [1, 4, 9...],使用for循环应该怎么写,使用列表推导式又应该怎么写呢?
"""
# list_square = []
# for i in range(1, 4):
# list_square.append(i**2)
# print(list_square)
#
# list_square2 = [i**2 for i in range(1, 4)]
# print("list_suqare2:", list_square2)
#
# list_square3 = [i**2 for i in range(1, 4) if i != 1]
# # for i in r... | false |
da0cd5a8d5ed63e56893410eec04ab7eb3df7cff | ARCodees/python | /Calculator.py | 458 | 4.21875 | 4 | print("this is a calculator It does all oprations but only with 2 numbers ")
opration = input("Enter your opration in symbolic way ")
print("Enter Your first number ")
n1 = int(input())
print("Enter Your second number ")
n2 = int(input())
if opration == "+":
print(n1 + n2)
elif opration == "-":
pri... | true |
b9e6f248199d58f6f185160a24febe997becf9e0 | Kwon1995-2/BC_Python | /chapter4/problem3.py | 564 | 4.46875 | 4 | """3명 이상의 친구 이름 리스트를 작성하고
insert()로 맨 앞에 새로운 친구 추가
insert()로 3번째 위치에 새로운 친구 추가
append()로 마지막에 친구추가
"""
friend = ["A","B","C"]
friend.insert(0,"D") #
friend.insert(3,"E")
print(friend)
friend.insert(100, "X") #append와 비슷한 기능
friend.append('a')
print(friend)
# numli = [1,2,3]
# numli.insert(1,17)
# print(... | false |
797cdc5d2c7d19a64045bc0fc1864fcefe0633b4 | carlmcateer/lpthw2 | /ex4.py | 1,065 | 4.25 | 4 | # The variable "car" is set to the int 100.
cars = 100
# The variable "space_in_a_car" is set to the float 4.0.
space_in_a_car = 4
# The variable "drivers" is set to the int 30.
drivers = 30
# The variable "passengers" is set to the int 90.
passengers = 90
# The variable cars_not_driven is set to the result of "cars" m... | true |
093233f29bfc50e37eb316fdffdf3a934aa5cea3 | manasjainp/BScIT-Python-Practical | /7c.py | 1,470 | 4.40625 | 4 | """
Youtube Video Link :- https://youtu.be/bZKs65uK1Eg
Create a class called Numbers, which has a single class attribute called
MULTIPLIER, and a constructor which takes the parameters x and y (these should
all be numbers).
i. Write a method called add which returns the sum of the attributes x and y.
ii. Write a class... | true |
d916840b3ec5c3efbb4ee0b1c1aea1ad42844d66 | omushpapa/minor-python-tests | /Large of three/large_ofThree.py | 778 | 4.40625 | 4 | #!/usr/bin/env python2
#encoding: UTF-8
# Define a function max_of_three()
# that takes three numbers as arguments
# and returns the largest of them.
def max_of_three(num1, num2, num3):
if type(num1) is not int or type(num2) is not int or type(num3) is not int:
return False
num_list = [num1, num2, n... | true |
e6134ced3a1fc1b67264040e64eba2af21ce8e1d | omushpapa/minor-python-tests | /List Control/list_controls.py | 900 | 4.15625 | 4 | #!/usr/bin/env python2
#encoding: UTF-8
# Define a function sum() and a function multiply()
# that sums and multiplies (respectively) all the numbers in a list of numbers.
# For example, sum([1, 2, 3, 4]) should return 10, and
# multiply([1, 2, 3, 4]) should return 24.
def sum(value):
if type(value) is no... | true |
6c58ca9f940f7ab15d3b99f27217b3bd485b01f9 | omushpapa/minor-python-tests | /Operate List/operate_list.py | 1,301 | 4.1875 | 4 | # Define a function sum() and a function multiply()
# that sums and multiplies (respectively) all the numbers in a list of numbers.
# For example, sum([1, 2, 3, 4]) should return 10,
# and multiply([1, 2, 3, 4]) should return 24.
def check_list(num_list):
"""Check if input is list"""
if num_list is Non... | true |
a193124758fc5b01168757d0f98cf67f9b98c664 | omushpapa/minor-python-tests | /Map/maps.py | 388 | 4.25 | 4 | # Write a program that maps a list of words
# into a list of integers representing the lengths of the correponding words.
def main():
word_list = input("Enter a list of strings: ")
if type(word_list) != list or len(word_list) == 0 or word_list is None:
print False
else:
print map... | true |
b0956c92848ea9087b83181d0dfcd360e45bdade | hubieva-a/lab4 | /1.py | 718 | 4.4375 | 4 | # Дано число. Вывести на экран название дня недели, который соответствует
# этому номеру.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
if __name__ == '__main__':
n = input("Number of the day of the week")
n = int(n)
if n == 1:
print("Monday")
elif n== 2:
p... | false |
96f5fbe27bf7bd62b365d50f0266ce8297042094 | amanotk/pyspedas | /pyspedas/dates.py | 1,592 | 4.15625 | 4 | # -*- coding: utf-8 -*-
"""
File:
dates.py
Description:
Date functions.
"""
import datetime
import dateutil.parser
def validate_date(date_text):
# Checks if date_text is an acceptable format
try:
return dateutil.parser.parse(date_text)
except ValueError:
raise ValueError("Incorre... | true |
5e0ca56488a3cda328eb88bd0a1fdd7ba6cb2bb8 | sreckovicvladimir/hexocin | /sqlite_utils.py | 1,702 | 4.125 | 4 | import sqlite3
from sqlite3 import Error
def create_connection(db_file):
""" create a database connection to the SQLite database
specified by db_file
:param db_file: database file
:return: Connection object or None
"""
conn = None
try:
conn = sqlite3.connect(db_file)
ret... | true |
04da350a513c7cc103b948765a1a24b9864686e1 | JayHennessy/Stack-Skill-Course | /Python_Intro/pandas_tutorial.py | 631 | 4.28125 | 4 | # Python Pandas tutorial (stackSkill)
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
data = pd.read_csv('C:/Users/JAY/Desktop/Machine_Learning_Course/KaggleCompetions/titanic_comp/data/test.csv')
# shows data on screen
print(data.head())
data.tail()
#print the number of rows (incldu... | true |
f62bd2ec440e3929c5aee99d0b90fd726e3f3eff | aniket0106/pdf_designer | /rotatePages.py | 2,557 | 4.375 | 4 | from PyPDF2 import PdfFileReader,PdfFileWriter
# rotate_pages.py
"""
rotate_pages() -> takes three arguements
1. pdf_path : in this we have to pass the user pdf path
2. no_of_pages : in this we have to pass the number of pages we want to rotate if all then by
default it takes zero then we re-intialize it to total n... | true |
e340d8b94dc7c2f32e6591d847d8778ed5b5378b | liorkesten/Data-Structures-and-Algorithms | /Algorithms/Arrays_Algorithms/isArithmeticProgression.py | 666 | 4.3125 | 4 | def is_arithmetic_progression(lst):
"""
Check if there is a 3 numbers that are arithmetic_progression.
for example - [9,4,1,2] return False because there is not a sequence.
[4,2,7,1] return True because there is 1,4,7 are sequence.
:param lst: lst of diff integers
:return: True... | true |
6101f3df70700db06073fd8e3723dba00a02e9d9 | liorkesten/Data-Structures-and-Algorithms | /Algorithms/Arrays_Algorithms/BinarySearch.py | 577 | 4.21875 | 4 | def binary_search_array(lst, x):
"""
Get a sorted list in search if x is in the array - return true or false.
Time Complexity O(log(n))
:param lst: Sorted lst
:param x: item to find
:return: True or False if x is in the array
"""
if not lst:
return False
i... | true |
a0e52ed563d1f26e274ef1aece01794cce581323 | samanthaWest/Python_Scripts | /DataStructsAndAlgorithms/TwoPointersTechnique.py | 784 | 4.3125 | 4 | # Two Pointers
# https://www.geeksforgeeks.org/two-pointers-technique/
# Used for searching for pairs in a sorted array
# We take two pointers one representing the first element and the other representing the last element
# we add the values kept at both pointers, if their sum is smaller then target we shift left... | true |
9a02e277ab565469ef0d3b768b7c9a0c053c2545 | JamesRoth/Precalc-Programming-Project | /randomMulti.py | 554 | 4.125 | 4 | #James Roth
#1/31/19
#randomMulti.py - random multiplication problems
from random import randint
correctAns = 0
while correctAns < 5: #loop until 5 correct answers are guessed
#RNG
num1 = randint(1,10)
num2 = randint(1,10)
#correct answer
ans = num1*num2
#asking the user to give the answe... | true |
ddda27bf9906caf8916deb667639c8e4d052a05f | AXDOOMER/Bash-Utilities | /Other/Python/parse_between.py | 918 | 4.125 | 4 | #!/usr/bin/env python
# Copyright (c) Alexandre-Xavier Labonte-Lamoureux, 2017
import sys
import numbers
# Parser
def parse(textfile):
myfile = open(textfile, "r")
datastring = myfile.read()
first_delimiter = '\"'
second_delimiter = '\"'
index = 0
while(index < len(datastring)):
first = datastring.find(fir... | true |
49c33bb519c6142f0832435d2a66054baceadf1a | cmedinadeveloper/udacity-data-structures-algorithms-project1-unscramble | /Task1.py | 666 | 4.25 | 4 | """
Read file into texts and calls.
It's ok if you don't understand how to read files.
"""
import csv
phone_nums = []
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
for text in list(reader):
phone_nums.extend(text[:2])
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
for cal... | true |
f150c2160c0c5b910fde7e3a05c40fc26e3c213c | HopeFreeTechnologies/pythonbasics | /variables.py | 1,419 | 4.125 | 4 | #So this file has some examples of variables, how they work, and more than just one output (like hi there.py did).
#######################
#
#Below is a variable by the name vname. V for variable and name for, well name.
# Its my first ever variable in Python so by default it's awesome, so i let it know by giving it t... | true |
11f7f93b4690191cd336a3884aa99ca24b5cdd8d | phoebeweimh/xiao-g | /归并排序.py | 1,225 | 4.4375 | 4 | #!/usr/bin/env python
# !coding:utf-8
# 归并排序(英语:Merge sort,或mergesort),是创建在归并操作上的一种有效的排序算法。该算法是采用分治法(Divide and Conquer)的一个非常典型的应用。
#分治法:
# 分割:递归地把当前序列平均分割成两半。
# 集成:在保持元素顺序的同时将上一步得到的子序列集成到一起(归并)。
import random
def SortByMerge(arr,size):
if size <= 1:
return arr
i = int(size/2)
left = SortB... | false |
d22a954c0a50eb89bd5c24f37cf69a53462e1d0c | dinabseiso/HW01 | /HW01_ex02_03.py | 1,588 | 4.1875 | 4 | # HW01_ex02_03
# NOTE: You do not run this script.
# #
# Practice using the Python interpreter as a calculator:
# 1. The volume of a sphere with radius r is 4/3 pi r^3.
# What is the volume of a sphere with radius 5? (Hint: 392.7 is wrong!)
# volume: 523.3
r = 5
pi = 3.14
volume = (4 * pi * r**3) / 3
print(volume)
... | true |
b3c9b758ea0b683aa4762a1e8e30bfffb2074a00 | spsree4u/MySolvings | /trees_and_graphs/mirror_binary_tree.py | 877 | 4.21875 | 4 |
"""
Find mirror tree of a binary tree
"""
class Node:
def __init__(self, data):
self.data = data
self.left = self.right = None
def mirror(root):
if not root:
return
mirror(root.left)
mirror(root.right)
temp = root.left
root.left = root.right
root.right = temp
... | true |
f29923bcb48d0f6fd0ea61207249f57ca0a69c6a | spsree4u/MySolvings | /trees_and_graphs/post_order_from_pre_and_in.py | 1,526 | 4.21875 | 4 |
# To get post order traversal of a binary tree from given
# pre and in-order traversals
# Recursive function which traverse through pre-order values based
# on the in-order index values for root, left and right sub-trees
# Explanation in https://www.youtube.com/watch?v=wGmJatvjANY&t=301s
def print_post_order(start, ... | true |
965e5afce19c0ab3dcaf484bdafa554dd4d51e4d | spsree4u/MySolvings | /trees_and_graphs/super_balanced_binary_tree.py | 2,240 | 4.125 | 4 | """
Write a function to see if a binary tree is "super-balanced".
A tree is "super-balanced" if the difference between the depths of any two
leaf nodes is no greater than one.
Complexity
O(n) time and O(n) space.
"""
class Node:
def __init__(self, data):
self.data = data
self.left = None
... | true |
3e92fa31734cdd480a102553fda5134de7aed2ba | aryansamuel/Python_programs | /jumble.py | 819 | 4.375 | 4 | # Aryan Samuel
# arsamuel@ucsc.edu
# prgramming assignment 6
# The following program asks the user for a jumbled word,
# then unjumbles and prints it.
# Note: The unjumbled word should be in the dictionary that is read by the prog.
def main(file):
file = open(file,'r')
word_list = file.read().split()
... | true |
203e35f62d3a64a25c87b1f88f8ba9b7ad33c112 | Shobhits7/Programming-Basics | /Python/factorial.py | 411 | 4.34375 | 4 | print("Note that facotrial are of only +ve integers including zero\n")
#function of facorial
def factorial_of(number):
mul=1
for i in range(1,num+1):
mul=mul*i
return mul
#take input of the number
num=int(input("Enter the number you want the fatcorial of:"))
#executing the function
if num<0 ... | true |
e98f42af716c60f62e9929ed5fa9660b3a1d678a | Shobhits7/Programming-Basics | /Python/palindrome.py | 364 | 4.46875 | 4 | # First we take an input which is assigned to the variable "text"
# Then we use the python string slice method to reverse the string
# When both the strings are compared and an appropriate output is made
text=input("Enter the string to be checked: ")
palindrom_text= text[::-1]
if text==palindrom_text:
print("Pal... | true |
1b2ec70312c8bf5d022cf2832fb3dfbf93c0d0f2 | Shobhits7/Programming-Basics | /Python/fibonacci_series.py | 1,110 | 4.40625 | 4 | # given a variable n (user input), the program
# prints fibinacci series upto n-numbers
def fibonacci(n):
"""A simple function to print fibonacci sequence of n-numbers"""
# check if n is correct
# we can only allow n >=1 and n as an integer number
try:
n = int(n)
except ValueError:
... | true |
537bfed643c059426bc9303f369efb0e1a9cc687 | MS642/python_practice | /objects/objects.py | 1,445 | 4.28125 | 4 | class Line:
"""
Problem 1 Fill in the Line
class methods to accept coordinates as a pair of tuples and return the slope and distance of the line.
# EXAMPLE OUTPUT
coordinate1 = (3, 2)
coordinate2 = (8, 10)
li = Line(coordinate1, coordinate2)
li.distance()
... | true |
22202840ae1c77f10c7e1f301ec5c0262b92e4e3 | lucasflosi/Assignment2 | /nimm.py | 2,011 | 4.40625 | 4 | """
File: nimm.py
-------------------------
Nimm is a 2 player game where a player can remove either 1 or 2 stones. The player who removes the
last stone loses the game!
"""
STONES_IN_GAME = 20 #starting quantity for stones
def main():
stones_left = STONES_IN_GAME
player_turn = 1
while stones_left > 0:
... | true |
f257c04116334c1a701cc28aa5b6b15485eea10a | Israel1Nicolau/Python | /condAninhadas000.py | 356 | 4.25 | 4 | nome = str(input('Digite seu nome: ')).strip().capitalize()
if nome == 'Israel':
print('Que nome bonito!')
elif nome == 'Pedro' or nome == 'Maria' or nome == 'Paulo':
print('Nome bastante comum')
elif nome in 'Ana Juliana Elisabeth Joana':
print('Belo nome feminino')
'''else:
print('Nome norma... | false |
8a99a85a0cb95bb61619ccdb7ed022b29c36aef1 | jizwang/pythonOOP | /OOP/魔法函数.py | 1,197 | 4.125 | 4 | # # __call__举例
# class A():
# # def __init__(self):
# # print("哈哈")
# def __call__(self):#对象当函数使用的时候触发
# print("我被调用了")
# # def __str__(self):#当对象被当做字符串使用的时候可以触发这个函数
# # return "图灵学院"
# def __repr__(self):
# return "图灵"
# a = A()
# a
# # print(a)
#__getattr__
# class A()... | false |
99dae88c68d64b67d1f29de82469af41bec6c687 | Mauc1201/Python | /data_structures/4_funciones_listas2.py | 604 | 4.28125 | 4 | # -*- coding: utf-8 -*-
# ------------- Funciones en listas -------------
lista_alfa = [0, 1, 10, 15, [3, 4, 10, 20, 5]]
# Uso de index en listas
print (lista_alfa.index(15))
print (lista_alfa[4].index(20))
#print (lista_alfa[3].index(1)) #Error por indice
if 15 in lista_alfa:
print ("Find")
else:
print ("Not... | false |
6a053f7dfbda90bf296646f4c4a45f5075243c84 | lion963/SoftUni-Python-Fundamentals- | /Functions/Calculations.py | 378 | 4.1875 | 4 | def simple_calculator(operator, num1, num2):
if operator=='multiply':
return int(num1*num2)
elif operator=='divide':
return int(num1/num2)
elif operator=='add':
return int(num1+num2)
elif operator=='subtract':
return int(num1-num2)
oper=input()
num_1=float(input())
num_2... | false |
e6d7b94ab9ee72d64ee17dee3db7824653bd5c51 | mgyarmathy/advent-of-code-2015 | /python/day_12_1.py | 1,078 | 4.1875 | 4 | # --- Day 12: JSAbacusFramework.io ---
# Santa's Accounting-Elves need help balancing the books after a recent order. Unfortunately, their accounting software uses a peculiar storage format. That's where you come in.
# They have a JSON document which contains a variety of things: arrays ([1,2,3]), objects ({"a":1, "b"... | true |
5937dd8901f02cb79eb422b7d3778353f540c052 | filfilt/pythonRepository | /Part022 Types of Methods.py | 805 | 4.25 | 4 | #Types of Methods
#Eg1:Instance Method
'''
class student:
schoolName = "school of techinology"
def __init__(self,fn,ln):
self.fname =fn
self.lname = ln
def getName(self):
self.fname=self.fname+"1st"
print("your full name is "+ self.fname+" "+self.lname)
s1=student("nega... | false |
040fcf183a0db97e0e341b7a3e9fec2f8adf24eb | BlueMonday/advent_2015 | /5/5.py | 1,778 | 4.15625 | 4 | #!/usr/bin/env python3
import re
import sys
VOWELS = frozenset(['a', 'e', 'i', 'o', 'u'])
NICE_STRING_MIN_VOWELS = 3
INVALID_SEQUENCES = frozenset(['ab', 'cd', 'pq', 'xy'])
def nice_string_part_1(string):
"""Determines if ``string`` is a nice string according to the first spec.
Nice strings contain at leas... | true |
10a4575fc55bc35c004b6ca826f7b50b9d269855 | jackedjin/README.md | /investment.py | 579 | 4.1875 | 4 | def calculate_apr():
"Calculates the compound interest of an initial investment of $500 for over 65 years"
principal=500
interest_rate=0.03
years=0
while years<65:
"While loop used to repeat the compounding effect of the investment 65 times"
principal=principal*(1+interest_rate)
"compound interest calculatio... | true |
f44cda077b7939465d6add8a9e845b3f72bc03c2 | NSLeung/Educational-Programs | /Python Scripts/python-syntax.py | 1,166 | 4.21875 | 4 | # This is how you create a comment in python
# Python equivalent of include statement
import time
# Statements require no semicolon at the end
# You don't specify a datatype for a variable
franklin = "Texas Instruments"
# print statement in python
print (franklin)
# You can reassign a variable any datat... | true |
dc7b6fdbee9d6a43089e7e1bccadd98deb2d7efc | Mezz403/Python-Projects | /LPTHW/ex16.py | 592 | 4.25 | 4 | from sys import argv # Unpack arguments entered by the user
script, filename = argv # unpack entered arguments into script and filename
txt = open(filename) # open the provided filename and assign to txt
print "Here's your file %r: " % filename # display filename to user
print txt.read() # print the contexts of the ... | true |
0b7f5b3f5e1b5e5d4bd88c37000bbfa0843af2bd | rachelsuk/coding-challenges | /compress-string.py | 1,129 | 4.3125 | 4 | """Write a function that compresses a string.
Repeated characters should be compressed to one character and the number of
times it repeats:
>>> compress('aabbaabb')
'a2b2a2b2'
If a character appears once, it should not be followed by a number:
>>> compress('abc')
'abc'
The function should handle letters, whitespac... | true |
f556169bc651d8d4f3dfef3a7a1696bef15e4664 | liu770807152/LeetCode | /021.merge-two-sorted-lists/21.merge-two-sorted-lists.py | 1,370 | 4.1875 | 4 | #עСղѧpython
```
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def mergeTwoLists(self, l1, l2):
#ָͷָ
head = dummy = ListNode(-1)
#ΪյʱȽϴССĽĿָ
while l1 and l2:
if l1.... | false |
744a17e55227470c63ceb499957400bd486113ab | oddporson/intro-python-workshop | /strings.py | 721 | 4.1875 | 4 | # strings are a sequence of symbols in quote
a = 'imagination is more important than knowledge'
# strings can contain any symbols, not jus tletters
b = 'The meaning of life is 42'
# concatenation
b = a + ', but not as important as learning to code'
# functions on string
b = a.capitalize()
b = a.upper()
b = b.lower()... | true |
d761e36ff3db8724b77a83d79537ee72db4e9129 | shirishavalluri/Python | /Objects & Classes.py | 2,574 | 4.25 | 4 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# Import the library
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', 'inline')
# In[12]:
class Circle(object):
#Constructor
def __init__(self, radius=3, color='blue'):
self.radius = radius;
self.color = color;
... | true |
1b39071c2140b24131741542defa41211e78b360 | marcvifi10/Curso-Python | /Python 1/3 - Colecciones/35 - Ejercicio 2 – Operaciones de conjuntos con listas/Ejercicio 2.py | 391 | 4.1875 | 4 | # Ejercicio 2
lista1 = [1,2,3,4,5,4,3,2,2,1,5]
lista2 = [4,5,6,7,8,4,5,6,7,7,8]
# Elimine los elementos repetidos de las dos listas
a = set(lista1)
b = set(lista2)
union = list(a | b)
soloA = list(a - b)
soloB = list(b - a)
interseccion = list(a & b)
print(f"Union: {union}")
print(f"Solo elementos A: {soloA}")
prin... | false |
386525ce0b00e19ab86ef73ec516d298d859e071 | marcvifi10/Curso-Python | /Python 2/1 - Sintaxis Básica/7 - Sintaxis Básica V. Las listas. Vídeo 7.py | 614 | 4.15625 | 4 | lista = ["Marc","Alex","Juan"]
print(lista[:])
print(lista[:2])
print(lista[1:2])
print(lista[1:3])
# Añadimos un nuevo valor a la lista
lista.append("Marina")
# Devuelve la posición del valor
print(lista.index("Marc"))
# Muestra si el valor esta dentr de la lista
print("Alex" in lista)
# Añadimos más valores a... | false |
7350e2b6288296a457d3791d5e2cebdc01baace3 | dkurchigin/gb_algorythm | /task7.py | 1,187 | 4.375 | 4 | # По длинам трех отрезков, введенных пользователем, определить возможность существования треугольника,
# составленного из этих отрезков.
# Если такой треугольник существует, то определить, является ли он разносторонним, равнобедренным или равносторонним
a = int(input("Введите длинну первого отрезка\n\n"))
b = int(inpu... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.