blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
95297b99949e123fbeaa89f84c7c4f14521b3187 | adhuliya/bin | /hidesplit | 2,288 | 4.125 | 4 | #!/usr/bin/env python3
"""
Splits a file into two chunks.
The first chunk is only few bytes.
"""
import sys
import os.path as osp
PREFIX = "hidesplit"
SIZE_OF_FIRST_CHUNK = 64 # bytes
BUFF_SIZE = 1 << 24
usageMsg = """
usage: hidesplit <filename>
note: file should be at least {} bytes.
It splits a file into two c... | true |
4cff866c37cb8f29fad30abba17cfae985b4e72d | heecer/old | /day2/list.py | 336 | 4.125 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Haccer
list1=['a','b','c','d','e']
# print(list1[1])
# print(list1[1:3])
# print(list1[-1])
# print(list1[-3:-1])
# print(list1[-3:])
list1.append('f')#追加
list1.insert(-1,'f')#插入
list1.remove('f')
list1.pop(-1)
del list1[0]
print(list1)
Index= list1.index('d')
prin... | false |
3bd3eecf4fc50c4edca1f32bae401c39e6cd06a7 | deniscostadsc/becoming-a-better-programmer | /src/problems/cracking_the_code_interview/is_unique.py | 1,170 | 4.15625 | 4 | from typing import Dict
"""
Implement an algorithm to determine if a string has all unique characters. What
if you cannot use additional data structures?
"""
def is_unique(s: str) -> bool:
"""
Time: O(n)
Space: O(n)
"""
chars: Dict[str, int] = {}
for char in s:
if char in chars:
... | true |
07561b35e66d0ead5615059c3c56744da1e67280 | kamalkundal/PythonProjects | /prime.py | 214 | 4.125 | 4 | n = int(input("Enter any num"))
if n<2:
print("not a prime")
else:
for i in range (2,n):
if (n%i==0):
print("not a prime")
break
else:
print("num is prime")
| false |
f40b9ded5cd4c74fa5b67a77902b4b0778f0ff7e | anilasebastian-94/pythonprograms | /Functions/prime.py | 553 | 4.125 | 4 | num=int(input('enter number'))
if num>1:
for i in range(2,num):
if num%i==0 :
print('number is not prime')
break
else:
print('number is prime')
#..................print not used here because print continously executes in for loop............................#
# num=int(... | true |
3e49cf303d7e05de993dada0d63c803c04401b13 | anilasebastian-94/pythonprograms | /flowofcontrols/looping/factorial.py | 294 | 4.125 | 4 | num=int(input('enter number'))
fact=1
if num>0 :
for i in range(1,num+1) :
fact*=i
print(fact)
elif num == 0:
print('Factorial of zero is 1')
else :
print('factorial doesnt exist for negative number')
# i=1
# while i<=num :
# prdct*=i
# i+=1
# print(prdct)
| true |
12e0c0d33ee64f94b6624fcc6b67099cbe4a24a2 | jjgagne/learn-python | /ex20.py | 1,237 | 4.28125 | 4 | # Author: Justin Gagne
# Date: July 4, 2014
# File: ex20.py
# Usage: python ex20.py ex20_sample.txt
# Description: Use functions to print an entire file or a file line-by-line
# allow command line args
from sys import argv
# unpack args
script, input_file = argv
# print entire contents of file
def print_all(f):
pri... | true |
37279fce63c80eb1f39475815db70ef9a412f3f9 | jjgagne/learn-python | /ex15.py | 717 | 4.125 | 4 | # import argv, which allows user to pass in parameters from command line
from sys import argv
# unpack argv
script, filename = argv
# create file object from the filename file (ex15_sample.txt in this case)
txt = open(filename)
# print out the contents to the console by calling txt.read()
print "Here's your file %r:... | true |
cc29f8ab6be4e6148ddfcbd89bbe8e5e2c611dd5 | jshamsutdinova/TFP | /8_lab/task_4.py | 1,826 | 4.25 | 4 | #!/usr/bin/env python3
""" Laboratory work 8. Task 4 """
from abc import ABC, abstractmethod
class Edication():
"""
This class defines the interface of edication to client
"""
def __init__(self, edication_system):
self._edication_system = edication_system
@property
def edication_syst... | true |
68f4607b1bc028ac64a29fc55b40f44bebef3b85 | creuter23/fs-tech-artist | /Staff/JConley/Scripts/Python Book Scripts/Chapter 2/trivia_script.py | 626 | 4.125 | 4 | #Trivia Script
#Minor exersice in using different types of data from user input
name = raw_input("Name? ")
age = int(raw_input("Age? "))
weight = int(raw_input("Weight?"))
print "\nHi, " + name
dog_years = age * 7
print "\nYou are ", dog_years , "in dog years."
seconds = age * 365 * 24 * 60 * 60
print ... | false |
59764f581af46fe1f43de830f3c8a09f641cd28b | edaniszewski/molecular_weight | /csv_reader.py | 802 | 4.1875 | 4 | import csv
class CSVReader():
"""
Implementation of a simple CSV reader. Contains a read method which operates on the filename which
the reader is instantiated with. This reader is tailored to read the resources/element_weights.csv
to create a dictionary, which is stored in the data member.
"""
... | true |
c233e6da46e7b2dc25d0e43c204745c15959b779 | hammam1311/age-calculator | /age_calculator.py | 971 | 4.21875 | 4 | from datetime import datetime
from datetime import date
def check_birthdate(year, month, day):
# write code here
today = date.today()
if int(year) > int(today.year):
return False
elif int(year) == int(today.year):
if int(month) > int(today.month):
return False
elif int(month) == int(today.month):
if in... | false |
efea2dfab3ed94a02d298ef65fbe913d8f669785 | charliedavidhoward/Learn-Python | /meanMedianMode.py | 1,244 | 4.40625 | 4 | # [Function] Mean, Median, and Mode
#
# Background
#
# In a set of numbers, the mean is the average, the mode is the number that occurs the most, and if you rearrange all the numbers numerically, the median is the number in the middle.
#
# Goal
#
# Create three functions that allow the user to find the mean, median, an... | true |
8e1fc385e39c1e0c355a07238880bf087096ce5d | Gaurav-dawadi/Python-Assignment-III | /A/question1.py | 563 | 4.15625 | 4 | # Bubble Sort Algorithm
import timeit
start = timeit.default_timer()
def bubbleSort(array):
n = len(array)
for i in range(n):
already_sorted = True
for j in range(n - i - 1):
if array[j] > array[j + 1]:
array[j], array[j + 1] = array[j + 1], array[j]
... | true |
4f57b9b429695ba7b4b84e52c822db4037d11288 | kanekko/python | /02-Introducción/Calculator.py | 1,253 | 4.15625 | 4 |
def operaciones(opcion, numero_a, numero_b):
if opcion == 1:
return numero_a + numero_b
elif opcion == 2:
return numero_a - numero_b
elif opcion == 3:
return numero_a * numero_b
elif opcion == 4:
return numero_a / numero_b
else:
print('Opción inválida')
pri... | false |
3e21d6d44a01c7d0129fb42cfcd76b93a9e5e171 | sojournexx/python | /Assignments/TanAndrew_assign4_problem1.py | 1,498 | 4.1875 | 4 | #Andrew Tan, 2/16, Section 010, Roll the Dice
from random import randint
result = False
while result == False:
s = int(input("How many sides on your dice? "))
#Check for valid data
if s < 3:
print("Sorry, that's not a valid size value. Please choose a positive number.")
conti... | true |
da8c803202a2c3e2b428e4298dac3c19b80eecdd | sojournexx/python | /Assignments/TanAndrew_assign2_problem2.py | 1,188 | 4.28125 | 4 | #Andrew Tan, 2/2, Section 010, Grade Calculator
#Ask user for name and class
name = input("What is your name? ")
course = input("What class are you in? ")
print()
#Ask user for weightage and test scores
weight_test = float(input("How much are tests worth in this class (i.e. 0.40 for 40%): "))
test1 = float... | true |
bffda2bd72fee372c85344b5274f7060e327aa47 | cecilmalone/PythonFundamentos | /Cap03/Lab02/calculadora_v1.py | 1,147 | 4.15625 | 4 | # Calculadora em Python
# Desenvolva uma calculadora em Python com tudo que você aprendeu nos capítulos 2 e 3.
# A solução será apresentada no próximo capítulo!
# Assista o vídeo com a execução do programa!
print("\n******************* Python Calculator *******************")
print()
print("""Selecione o número da op... | false |
760be593820d8aaf4ff443aa3892f1b96d577a9d | pulosez/Python-Crash-Course-2e-Basics | /#6: Dictionaries/favorite_numbers.py | 842 | 4.1875 | 4 | # 6.2.
favorite_numbers = {
'john': 1,
'anna': 7,
'edward': 22,
'jane': 5,
'kate': 3,
}
print(favorite_numbers)
num = favorite_numbers['john']
print(f"John's favorite number is {num}.")
num = favorite_numbers['anna']
print(f"Anna's favorite number is {num}.")
num = favorite_numbers['edward']
print(... | false |
73682e4924c8d23279b3ef56c65ac5715bc2d7b2 | pulosez/Python-Crash-Course-2e-Basics | /#5: if Statements/favourite_fruits.py | 417 | 4.1875 | 4 | # 5.7.
favourite_fruits = ['orange', 'apple', 'tangerine']
if 'orange' in favourite_fruits:
print("You really like oranges!")
if 'apple' in favourite_fruits:
print("You really like apples!")
if 'tangerine' in favourite_fruits:
print("You really like tangerines!")
if 'banana' in favourite_fruits:
print("... | true |
6c383b3dc9c39f8963ef2afac3eccfba06c378f4 | Jamesong7822/Python-Tutorials | /0) Introduction To Python/tutorials.py | 2,460 | 4.125 | 4 | # def myfunction(a,b,c):
# # Myfunction checks if any number from 0 - 99 is divisible by a, b and c
# ans_list = []
# for i in range(100):
# if i % a == 0 and i % b == 0 and i % c == 0:
# ans_list.append(i)
# return ans_list
# print(myfunction(1,2,3))
# D) Write a function that randomly chooses a number fr... | true |
90acca5899c8ecf3891bcc8339ad16a0fcb2fbca | strawsyz/straw | /ProgrammingQuestions/牛客/对称的二叉树.py | 928 | 4.15625 | 4 | # -*- coding:utf-8 -*-
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# 画个二叉树就能理解
# 一个节点左右节点的值相同
# 左节点的左节点要与右节点的右节点相同
# 左节点的右节点要与右节点的左节点相同
class Solution:
def isSymmetrical(self, pRoot):
# write code here
if not pRoot:
... | false |
4612293ef47d0ac146502d3ba6b5373b904fa951 | Metalscreame/Python-basics | /functions/zip.py | 368 | 4.25 | 4 | # В Pyhon функция zip позволяет пройтись одновременно по нескольким итерируемым объектам (спискам и др.):
a = [10, 20, 30, 40]
b = ['a', 'b', 'c', 'd', 'e']
for i, j in zip(a, b):
print(i, j) # (10, a)
zip_obj = zip(a, b)
list_zip = list(zip_obj) # list of tuples
print(list_zip)
| false |
8fd2ebf33486069e8e7939bd54465ceefe6370a3 | Metalscreame/Python-basics | /date.py | 2,670 | 4.125 | 4 | from datetime import datetime, timedelta
# parsing date
now = datetime.now()
some_date = '01/02/1903'
date_format = '%d/%m/%Y'
parsed_date = datetime.strptime(some_date, date_format)
print(parsed_date)
one_day = timedelta(
days=1,
minutes=2
)
new_date = parsed_date-one_day
print('Parsed minus one day: ', new... | true |
2f8b4ee8c6145451ed2d9b588314bc1ee117fb9e | JomHuang/PythonStudy | /Day_2/Preview/OOP/person.py | 936 | 4.46875 | 4 | """
开始OOP学习
1.结构
2.封装
3.定制
定义一个类
"""
class Person:
# 相当与构造函数
def __init__(self, name, age, pay=0, job=None):
self.name = name;
self.age = age;
self.pay = pay;
self.job = job;
# 取lastname
def lastname(self):
return self.name.split()[-1];
# 加薪
def giveRa... | false |
fb1158f7b2802185143717b1dfc4b1ebc28c7cbd | rahulvennapusa/PythonLearning | /SquareInt.py | 240 | 4.15625 | 4 | number = input("Enter the integer :")
if int(number) > 0:
iteration = int(number)
ans = 0
while iteration != 0:
ans = ans + int(number)
iteration = iteration - 1
print("Square of %s is %s :" % (number, ans))
| true |
33b4192303fd75f5cf8c60653820ec03589902cd | SuyeshBadge/Python-in-30-Days | /Day 1/DataType.py | 1,561 | 4.34375 | 4 | '''
Data type in python
int
float
string
list
tuple
dictionary
set
boolean (true or false)
'''
################################
'''
Iterable {list string tuples set dictionary}
non iterable {int float}
'''
#######################
# int float str
"""
int #integer for numbers 1,2,3,4
float #float for decimal numbers e... | false |
dc29468021664d1d55e42ac4d0121816655aeb85 | David-H-Afonso/python-basic-tests | /coinExchange.py | 818 | 4.21875 | 4 | # Function
def exchange(coin):
return coin / dollars
# Inputs
dollars = input("Write the amount of dollars you want to exchange: ")
dollars = float(dollars)
coin = input("""
Choose the coin that you want to exchange the value by typing the number. By default this value is "Euros"
1 - Euros
2 - Pesos argentinos
3 ... | true |
e922fc7376a58caf2606224a864acd068c7e975a | SelimRejabd/Learn-python | /string method.py | 552 | 4.25 | 4 | # few useful method for string
name = "reja"
# lenth of string
print(len(name))
# finding a charecter
print(name.find("a"))
# Capitalize "reja" to "Reja"
print(name.capitalize())
# uppercase of a string
print(name.upper())
# lowecase of a string
print(name.lower())
# is string digit or not
prin... | true |
893ae9a7901c8ce7030ca0efdb4c81dba293c3ba | nicolealdurien/Assignments | /week-02/day-1/user_address.py | 1,673 | 4.4375 | 4 | # Week 2 Day 1 Activity - User and Address
# Create a User class and Address class, with a relationship between
# them such that a single user can have multiple addresses.
class User:
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
self.ad... | true |
6011e9272ce81b903109d50f6c82fab57b46a60c | fpoppe/How-Many-Times-I-Have-to-Fold | /n_fold.py | 1,008 | 4.28125 | 4 | import math
def main ():
print("\n Welcome to 'HOW MANY TIMES DO I HAVE TO FOLD?' \n")
distance = float(input("\n Give me the distance (a number) \n"))
#usuário nao pode botar algo diferente de numero
unit = input("Give me its unit (km, m or mm) \n")
unit = unit.lower()
while unit != "k... | false |
980c11b94a9ee491ee2095727036a6ed2b966145 | sichkar-valentyn/Dictionaries_in_Python | /Dictionaries_in_Python.py | 1,597 | 4.75 | 5 | # File: Dictionaries_in_Python.py
# Description: How to create and use Dictionaries in Python
# Environment: PyCharm and Anaconda environment
#
# MIT License
# Copyright (c) 2018 Valentyn N Sichkar
# github.com/sichkar-valentyn
#
# Reference to:
# [1] Valentyn N Sichkar. Dictionaries in Python // GitHub platfo... | true |
ca2e22bf764551e91fdaf13c469258ff3821462c | leinad520/Monty-Hall-Game | /mp_game_simulation.py | 1,867 | 4.125 | 4 | from random import randrange, choice
win_count = 0
def monty_python_game():
# print("You have three doors to choose from. Behind one door is the prize; two other doors have nothing. Which do you choose?")
choicesArr = ["1","2","3"]
prize = choice(choicesArr)
# your_choice = input("type 1 2 or 3\n> ... | true |
1d0abd1db93be3e724570699313277d0c0970653 | rbdjur/Python | /Practice_Modules/Python_object_and_Data_Structure_basics/sets/set.py | 402 | 4.15625 | 4 | myset = set()
#add number 1 to set
myset.add(1)
print(myset)
#add number 2 to the set
myset.add(2)
#add number 2 again to the set
myset.add(2)
#see what the results of a set are
print(myset)
#Only {1,2} are in set despite adding two 2's. this is because a set only holds unique values. IF the value already exist... | true |
0a79efb7b2540019d6d572528ec99a71d41313a3 | rbdjur/Python | /Practice_Modules/Errors_handling_exceptions/try_except_else.py | 696 | 4.21875 | 4 | #The try block will execute and examine the code in this block
try:
result = 10 + 10
print(result)
except:
#if the code contains an error, the code in the except block will execute
print("Adding is not happening check type")
#The try block will execute and examine the code in this block
try:
# a... | true |
c427137c075c714607fc7b740437824b7fe4aae3 | rbdjur/Python | /Practice_Modules/Python_object_and_Data_Structure_basics/variable_assignments/variable_assignments.py | 235 | 4.125 | 4 | my_dogs = 2
my_dogs = ["Sammyy", "Frankie"]
#Above is an example of dynamic typing that allows user to assign different data type
a = 5
print(a)
a = 10
print(a)
a = a + a
print("should be 20", a)
print(type(a))
print(type(my_dogs)) | true |
98806536f6a7adea80fa82bdfaf9876ce8e57b00 | laszlokiraly/LearningAlgorithms | /ch04/linked.py | 1,740 | 4.40625 | 4 | """
Linked list implementation of priority queue structure.
Stores all values in descending.
"""
from ch04.linked_entry import LinkedEntry
class PQ:
"""Heap storage for a priority queue using linked lists."""
def __init__(self, size):
self.size = size
self.first = None
self.N = 0
... | true |
f9e1c7f094f2104fa7975c4e843e8ca1cfc1e96d | arthurleemartinez/InterestTools | /high_interest_loan.py | 2,948 | 4.15625 | 4 | user_principle: float = float(input("How much is the principle amount of your loan?"))
def get_boolean_user_plans():
user_answer: str = input("Do you plan to pay off at least some of it soon? Answer 'yes' or 'no'.")
if user_answer != 'yes' or 'Yes' or 'YES' or 'y' or 'Y':
return False
else:
... | true |
6e4fd23cb4a7129f0a9b5ca3ffb6fb1647f0e321 | nawaraj-b5/random_python_problems | /Python Basics/datatype_conversion.py | 391 | 4.5 | 4 | #Find the length of the text python and convert the value to float and convert it to string
length_of_python = ( len('python') )
length_of_python_in_float = float(length_of_python)
length_of_python_in_string = str( length_of_python )
print ('Length of the python in integer is {}, float is {}, and string is {} '.format(... | true |
67d38a1b0a4d052650402639c71eb1b6807f8d00 | heba-ali2030/examples | /largest_number.py | 423 | 4.40625 | 4 | #Python Program to Find the Largest Among Three Numbers
num1= int(input('choose first number: '))
num2= int(input('choose second number: '))
num3= int(input('choose third number: '))
if num1 > num2 and num1 > num3 :
print('num 1 is the largest')
elif num2 > num1 and num2 > num3 :
print('num 2 is the largest'... | false |
a78fae1eb24fbb75cf328d20e83cec97d051356d | oluwafenyi/code-challenges | /CodeWars/6Kyu/Valid Braces/valid_braces.py | 737 | 4.3125 | 4 |
# https://www.codewars.com/kata/valid-braces
# Write a function that takes a string of braces, and determines if the order
# of the braces is valid. It should return true if the string is valid,
# and false if it's invalid.
def validBraces(string):
while '[]' in string or '{}' in string or '()' in string... | true |
1db206efd070dfa46493a2cdabf2f268e8d7cad0 | oluwafenyi/code-challenges | /CodeWars/6Kyu/Find the Missing Letter/find_missing_letter.py | 294 | 4.25 | 4 |
#https://www.codewars.com/kata/find-the-missing-letter
from string import ascii_letters
def find_missing_letter(chars):
ind = ascii_letters.index(chars[0])
corr_seq = list(ascii_letters[ind:ind+len(chars)+1])
return [char for char in corr_seq if char not in chars][0]
| true |
345c2f179becc434547007db6863d0cd1b1226cf | l0neaadil/Python_for_beginner | /10_if_elif_else.py | 860 | 4.21875 | 4 | # if...elif ...else
x = float(input("enter a no.: "))
if x == 0:
print("no. is neither positive nor negative")
elif x < 0:
print("no. is negative")
else:
print("no. is positive")
print("Done")
# Nested if_else
x = int(input("enter any integer: "))
if x == 0:
print("no. is neither positive nor negati... | false |
3a38adf993db23d3b0dca7820c04e4e57ec4db9d | l0neaadil/Python_for_beginner | /14_for_loop.py | 552 | 4.15625 | 4 | # For Loop
string = "3456789"
list = [3, 4, 5, 6, 7, 8, 9]
tuple = (3, 4, 5, 6, 7, 8, 9)
set = {3, 4, 5, 6, 7, 8, 9}
dictionary = {1: 'a', 2: 'b', 3: 'c'}
print(string, list, tuple, set, dictionary)
for element in string:
print(element)
for element in list:
print(element)
for element in tuple:
print(eleme... | false |
f78d289529201648db63dbc4981b5ab121b3c61f | pathakamaresh86/python_class_prgms | /day5_assign.py | 1,119 | 4.28125 | 4 | #!/usr/bin/python
num1=input("Enter number")
print "Entered number ", num1
# if LSB(last bit) is zero then even if 1 then odd
if num1&1 == 0:
print str(num1) + " is even number"
else:
print str(num1) + " is odd number"
num1=input("Enter number")
print "Entered number ", num1
if num1&15 == 0:... | true |
e48a1567b7c529cb7a6ff50ab7cf22844dc2b19f | pathakamaresh86/python_class_prgms | /day4_assign.py | 1,011 | 4.21875 | 4 | #!/usr/bin/python
str=input("Enter string")
print "Entered string ", str
print "first tow and last two char string ", str[1:3:1]+str[-1:-3:-1]
str1=input("Enter string")
print "Entered string ", str1
print "occurance replaced string", str1[:1]+str1[1:].replace("b", "*")
str1,str2=input("Enter two strings... | true |
4e012bf0e6c051ee2585c2c27d33cd92c9babbe0 | krishnagoli/python | /Harikah/test5.py | 836 | 4.1875 | 4 | my_string="Hello world"
print(my_string.isalpha())
Output : False
str1="HelloWorld"
print(str1.isalpha())
Output : True
str="hfdgkjfdhg"
print(str.isdigit())
Output : False
str="hfdgkjfdhg123"
print(str.isdigit())
Output : False
str="45435435435h"
print(str.isdigit())
Output : False
str="45435435435"
print(str.isd... | false |
08ab6206785466e01758fc3df211b289d73e4fb6 | MunsuDC/visbrain | /examples/signal/02_3d_signals.py | 1,665 | 4.15625 | 4 | """
Plot a 3D array of data
=======================
Plot and inspect a 3D array of data.
This example is an extension to the previous one (01_2d_signals.py). This time,
instead of automatically re-organizing the 2D grid, the program use the number
of channels for the number of rows in the grid and the number of trial... | true |
82d1b9ee2f5a78cd095960a36a58e19b6239409e | zoeyouyu/GetAhead2020 | /Q3 - solution.py | 1,240 | 4.25 | 4 | # Longest path in the Tree
class Tree:
def __init__(self, value, *children):
self.value = value
self.children = children
# We walk the tree by iterating throught it,
# yielding the length of the path ending at each node we encounter,
# then take the max of that.
def longest_path(tree):
def rec(current, ... | true |
d54ce4cf2c186d149f51a6a37de807fbabdca25f | ritomar/ifpi-404-2017 | /Simulado01-Q02.py | 297 | 4.15625 | 4 | quantidade = 0
soma = 0
n = int(input("Digite um valor qualquer, zero para terminar: "))
while n != 0:
quantidade += 1
soma += n
n = int(input("Digite um valor qualquer, zero para terminar: "))
print("Quantidade:", quantidade)
print("Soma:", soma)
print("Média:", soma/quantidade)
| false |
d386a27c06a6252f2331beff919a290887cd4825 | saikumarsandra/My-python-practice | /Day-5/variableLengthArg.py | 418 | 4.25 | 4 | # when * is added before any argument then t act as the variable length argument
#it act as a parameter that accepts N number of values to one argument act as a tuple
def myFun(a,*b):
print (a,b)
myFun("sai",2.0)
#type 2
myFun("this is 'a'",2.0,1,2,3,4,5,6,[1,2,3],(1,2,3),{9,8,10})
def avg(*vals):
... | true |
684e219a422c35b538a6acfe6a780d3d04c06b89 | xpony/LearnPython | /def_function.py | 1,777 | 4.28125 | 4 | #自定义一个求绝对值的my_abs函数为例:\
# 方式 依次写 def 函数名 括号(及参数) :
def my_abs(x):
if x >= 0:
return x #return 返回函数值
else:
return -x
print(my_abs(-3))
#注意,函数体内部的语句在执行时,一旦执行到return时,函数就执行完毕,并将结果返回。
#如果没有return语句,函数执行完毕后也会返回结果,只是结果为None。return None可以简写为return。
#如果你已经把my_abs()的函数定义保存为abstest.py文件了,那么,
#可以在该文件的当前目录下启动Python解释器... | false |
9a756fc8eac6f99a6e95a7cbe9e99c04ce777eb0 | xpony/LearnPython | /filter.py | 2,078 | 4.25 | 4 | #filter( )函数 用于过滤序列。同样接收一个函数和一个序列,把传入的函数依次作用于每个元素,
#然后根据返回值是True还是False决定保留还是丢弃该元素。和map()一样返回的是Iterator
#例如,在一个list中,删掉偶数,只保留奇数,可以这么写:
def is_odd(n):
return n % 2 == 1 # 判断是否为奇数
num = filter(is_odd, [1, 2, 3, 4, 5, 6, 10])
print(list(num))
#把一个序列中的空字符串删掉,可以这么写:
def not_empty(s):
return s and s.strip() #strip()去除字... | false |
790c398b7699707dd0881780f58dd63961956cf5 | xpony/LearnPython | /slice.py | 1,795 | 4.125 | 4 | #切片(Slice):
#取一个list或tuple的部分元素是非常常见的操作。比如,取前n个元素,我们可以用循环,但是太麻烦了。如果用切片就会非常简单:
L = [1, 2, 3, 4, 5]
print(L[0:2]) #取前两个元素
print(L[:2]) # 从索引零开始,可以省略
print(L[1:]) # 前
print(L[2:5]) #可以从索引2开始取,取到第五个
print(L[2:]) #默认取完
#既然Python支持L[-1]取倒数第一个元素,那么它同样支持倒数切片
print(L[-2:]) #从倒数第二个开始,取完
print(L[-2:-1])
print(L[1:3])
print(... | false |
0eb90832223c089e86b7ca5c0eda3f576f7b414f | mondon11/leetcode-top100 | /0021mergeTwoLists.py | 1,585 | 4.125 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/6/14 下午9:06
# @Author : jt_hou
# @Email : 949241101@qq.com
# @File : 0021mergeTwoLists.py
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class ... | false |
03edbcdf7a43db403c91d9499f8c7c90a1afdcbe | tsoporan/exercises_and_algos | /python/observer.py | 1,096 | 4.28125 | 4 | """
An example of the Observer pattern in Python.
A Subject keeps track of its observers and has a method of notifying them.
"""
class Subject(object):
def __init__(self):
self.observers = []
def register_observer(self, observer):
self.observers.append(observer)
def unregister_observer(self, obser... | true |
f0407174a9908c1a73ee250296d334ae73bb178a | tsoporan/exercises_and_algos | /python/utopian_tree.py | 762 | 4.34375 | 4 | """
Utopian tree goes through 2 cycles of growth a YEAR.
First cycle in spring: doubles in height
Second cycle in summer: height increases by 1
Tree is planted onset of spring with height 1.
Find the height of tree after N growth cycles.
"""
def growthAfterCycles(lst):
out = []
for cycle in lst:
h... | true |
bb8bb6ca07ad5d3793b8e24fdee189d83657e294 | wprudencio97/csc121 | /wprudencio_lab6-8.py | 1,759 | 4.40625 | 4 | #William Prudencio, Chapter 6 - Lab 8, 8/18/19
''' This program reads the random numbers that were generated into
randomNumbers.txt and will display the following: 1)Count of the
numbers in the file, 2)Total of the numbers in the file, 3)Average of
the numbers in the file, 4)Largest and smallest number in the file. '... | true |
315af1bee922074ca17a8b8002f87057224921e6 | deanjingshui/Algorithm-Python | /17_位运算/231. 2的幂.py | 1,735 | 4.3125 | 4 | """
给定一个整数,编写一个函数来判断它是否是 2 的幂次方。
示例 1:
输入: 1
输出: true
解释: 2^0 = 1
示例 2:
输入: 16
输出: true
解释: 2^4 = 16
示例 3:
输入: 218
输出: false
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/power-of-two
"""
class Solution_iterate:
"""
date:2020.9.18
author:fenghao
思路:
从0开始尝试,计算2的m次幂是否等于n,当计算结果大于n说明无法满... | false |
a2989a38d363fa9517600d06844a71e590ae38c4 | deanjingshui/Algorithm-Python | /5_二叉树/1. 二叉树的前序遍历.py | 2,253 | 4.375 | 4 | """
给定一个二叉树,返回它的 前序 遍历。
示例:
输入: [1,null,2,3]
1
\
2
/
3
输出: [1,2,3]
进阶: 递归算法很简单,你可以通过迭代算法完成吗?
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/binary-tree-preorder-traversal
"""
from typing import List
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
se... | false |
c841dfbd88298c7f0a27e3a18d0e1533aad0b6e2 | deanjingshui/Algorithm-Python | /1_双指针/11. 盛最多水的容器.py | 1,411 | 4.125 | 4 | """
给你 n 个非负整数 a1,a2,...,an,每个数代表坐标中的一个点 (i, ai) 。
在坐标内画 n 条垂直线,垂直线 i 的两个端点分别为 (i, ai) 和 (i, 0) 。
找出其中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/container-with-most-water
"""
from typing import List
class Solution_force:
"""
author:fenghao
date:2021.4... | false |
ff9d8d7b4f3b4cba24822850d4fb1d78f52b9439 | Gyol/Multicampus_Cloud | /common_ground/python_programming_stu/mycode/11_Lambda/lambda01.py | 1,407 | 4.125 | 4 | # 보통 함수
def add(x, y):
return x + y
print(add(10, 20))
# lambda
add2 = lambda x, y : x + y
print(add2(100, 200))
# 제곱승, 곱하기, 나누기를 람다 함수로 정의해서 호출
print()
multi = lambda x, y : x ** y
print(multi(2, 4))
mul = lambda x, y : x * y
print(mul(18, 2))
dev = lambda x, y : x / y
print(dev(20, 4))
mulmul = lambda x: x ... | false |
126540b591dd05de840b78447860cc2130c03326 | svetlana-strokova/GB_BigData_1055_Python | /3/3 les 2page.py | 817 | 4.21875 | 4 | # 2 Задание Реализовать функцию, принимающую несколько параметров
# переменные
name = input('Введите имя - ')
surname = input('Введите фамилию - ')
year = int(input('Введите год рождения - '))
city = input('Введите город проживания - ')
email = input('Введите email - ')
telephone = input('Введите телефон - ')
#функция ... | false |
0a889f350a8c1b1efd46316f5786a8191250d934 | svetlana-strokova/GB_BigData_1055_Python | /1lesson/1les 2page.py | 1,289 | 4.125 | 4 | # 2 Задание. Переведение секунд в минуты и часы с форматированием строк
time = int(input('Введите время в секундах - '))
hours = time // 3600
#целочисленное деление
minutes = (time // 60) - (hours * 60)
# Из целого остатка часов остаток - минуты
seconds = time % 60
# Остаток от деления часов и минут - секунды. 60 - по... | false |
a9caaccc5a5ade933817c50c8a8daf912b3c0255 | Tripl3Six/Rock-paper-scissors-lizard-spock | /rpsls.py | 2,206 | 4.1875 | 4 | # Rock-paper-scissors-lizard-Spock
# The key idea of this program is to equate the strings
# "rock", "paper", "scissors", "lizard", "Spock" to numbers
# as follows:
#
# 0 - rock
# 1 - Spock
# 2 - paper
# 3 - lizard
# 4 - scissors
import random as rand
# helper functions
def name_to_number(name):
if name == 'ro... | true |
af76dc1189d8b1985cd069e250ca17ee1bde6dff | MahjubeJami/Python-Programming-01 | /python essentials/mod03-exe03.py | 994 | 4.5625 | 5 | """
3. You are trying to build a program that will ask the user the following:
First Name
Temperature
Based on the user's entries, the program will recommend the user to wear
a T-shirt if the temperature is over or equal to 70º or bring a sweater if it is less than 70º.
Console Output
What s... | true |
1201f750d7ccc0c120fe4773ec50337bce5dc8c2 | MahjubeJami/Python-Programming-01 | /python strings/mod06-exe_6.7.py | 1,890 | 4.21875 | 4 | # Using the variable famous_list, write a program to check
# if a famous individual is in the list above, if they are
# then print: Sorry, the individual did not make the top 20 cut!
# Otherwise print: Yup, the individual did make the top 20 cut.
#
# Console:
#
# Please Enter the name of the famous individual? A... | true |
3ab92c4162bb89747c786a4a6975a083f06dd368 | MahjubeJami/Python-Programming-01 | /python strings/mod06-exe_6.4.py | 834 | 4.4375 | 4 | """
4. Write a Python function to create the HTML
string with tags around the word(s).
Sample function and result are shown below:
add_html_tags('h1', 'My First Page')
<h1>My First Page</h1>
add_html_tags('p', 'This is my first page.')
<p>This is my first page.</p>
add_html_tags('h... | true |
be23e3bb52a6a191041264d2430fde3a4a1ebdd6 | richardOlson/Intro-Python-I | /src/13_file_io.py | 1,172 | 4.375 | 4 | """
Python makes performing file I/O simple. Take a look
at how to read and write to files here:
https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files
"""
# importing the os to get the path to find the file
import os
fooPath = os.path.join(os.path.dirname(__file__), "foo.txt")
# Open up t... | true |
399553cdf2290f687ec9466a0ccf1353c2a1e2b9 | pratikshyad32/pratikshya | /rock paper scissor game.py | 1,833 | 4.1875 | 4 | name=input("Enter your name")
while name.isalpha()==False or len(name)<6:
name=input("your name is wrong please enter again")
else:
print("Hello",name)
age=(input("Enter your age"))
while age.isdigit()==False :
age=input("your age is wrong please enter again")
else:
print("your age is accep... | true |
a2caca192e370b9e3565139dddb0515cff9ea421 | SaiSudhaV/TrainingPractice | /ArraysI/array_square.py | 312 | 4.1875 | 4 | # 3 Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.
def squares(ar):
return sorted([i ** 2 for i in ar])
if __name__ == "__main__":
n = int(input())
ar = list(map(int, input().split()))
print(squares(ar)) | true |
7e60df36ee9effdd2a5b732fb34ad6b33b33b89b | Ap6pack/PythonProjects | /UserMenu | 2,436 | 4.34375 | 4 | #!/usr/bin/env python3
### What and where the information is being stored
userTuples = ["Name", "Age", "Sex"]
userList = [ ]
age2 = []
sex2 = []
### I have used def to define my menu so I can use this format over and over.
def userDirectory():
print "1. Add your information to the list"
... | true |
c045170367b61dbc0554b69f6c63ccd8caf176fc | chloebeth/codex-celerate | /benchmarks/code_output_4.py | 542 | 4.1875 | 4 | # - Time complexity: O(n)
# - Space complexity: O(n)
def myPow(x, n):
if n == 0:
return 1
if n < 0:
return 1 / myPow(x, -n)
if n % 2:
return x * myPow(x, n - 1)
return myPow(x * x, n / 2)
# Optimize the space complexity of the above code
#
# - Time complexity: O(n)
# - Space com... | false |
d311436ad2902a7ccc5ea809669a280ab0aea17a | oekeur/MinProg_DataToolkit | /Homework/Week 1/exercise.py | 2,028 | 4.25 | 4 | # Name : Oscar Keur
# Student number : 11122102
'''
This module contains an implementation of split_string.
'''
# You are not allowed to use the standard string.split() function, use of the
# regular expression module, however, is allowed.
# To test your implementation use the test-exercise.py script.
# A note about... | true |
9f8efa161d8ef1b8bf35075c4723e4453cc265fc | licup/interview-problem-solving | /Module 7/kBackspace.py | 838 | 4.125 | 4 | '''
K Backspaces
The backspace key is broken. Every time the backspace key is pressed, instead of deleting the last
(non-backspace) character, a '<' is entered.
Given a string typed with the broken backspace key, write a program that outputs the
intended string i.e what the keyboard output should be when the backsp... | true |
968f323dc9381b444f1341813449e458dcc78e62 | licup/interview-problem-solving | /Module 7/sya.py | 1,342 | 4.15625 | 4 | '''
Reverse polish notation is a postfix notation for mathematical expressions.
For example, the infix expression (1 + 2) / 3 would become 1 2 + 3 /.
More detailed explanation here: https://en.wikipedia.org/wiki/Reverse_Polish_notation
Task:
Given a mathematical expression in reverse polish notation, represented by... | true |
de6836359ebbac88fe38613153af669a9af33902 | thisislola/Tutorials | /temp_calculator.py | 1,825 | 4.28125 | 4 | # Temperature Calculator by L. Carthy
import time
def intro_options():
""" Takes the option and returns the fuction
that correlates """
option = int(input("1 for Fahrenheit to Celsius \n"
"2 for Celcius to Fahrenheit \n"
"3 for Fahrenheit to Kelvin: "))
... | true |
db54e4a06079cbba0c755e0df03afbe2892eb739 | satishkr39/MyFlask | /Python_Demo/Class_Demo.py | 1,415 | 4.46875 | 4 | class Sample:
pass
x = Sample() # creating x of type Sample
print(type(x))
class Dog:
# def __init__(self, breed):
# self.breed = breed
# CLASS OBJECT ATTRIBUTE IT will always be same for all object of this class
species = 'Mammal'
# INIT METHOD CALLED EVERY TIME AN OBJECT IS CREATED
... | true |
c9685fe1d887a5f52952043f559ce6e71108ef27 | anand-ryuzagi/Data-Structue-and-Algorithm | /Sorting/merge-sort.py | 1,123 | 4.25 | 4 | # mergesort = it is divide and conquer method in which a single problem is divided in to small problem of same type and after solving each small problem combine the solution.
# Time complexity : O(nlogn)
# Space complexity : O(n)
# algorithms :
# 1. divide the array into two equal halves
# 2. recursively divide each... | true |
4691857dd272f5ed6cd0bb040dfe7157ad429407 | micaris/Data-Structures-and-Algorithms | /Sorting.py | 1,715 | 4.125 | 4 | #Bubble sort
def bubble_sort(a_list):
for pass_num in range(len(a_list) - 1, 0, -1):
for i in range(pass_num):
if a_list[i] > a_list[i + 1]:
temp = a_list[i]
a_list[i] = a_list[i + 1]
a_list[i + 1] = temp
def selection_sort(a_list):
for fill_... | false |
7b498522f914cf3f88d686578da8201adaf2bb10 | devathul/prepCode | /DP/boxStacking.py | 2,661 | 4.21875 | 4 | """
boxStacking
Assume that we are given a set of N types 3D boxes; the dimensions are defined for i'th box as:
h[i]= height of the i'th box
w[i]= width of the i'th box
d[i]= depth of the i'th box
We need to stack them one above the other and print the tallest height that can be achieved. One type of box can be used... | true |
92bcb1209ffeea2320590bd05a442c73bf492dfe | connorholm/Cyber | /Lab2-master/Magic8Ball.py | 960 | 4.125 | 4 | #Magic8Ball.py
#Name:
#Date:
#Assignment:
#We will need random for this program, import to use this package.
import random
def main():
#Create a list of your responses.
options = [
"As I see it, yes.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrat... | true |
115595d836d0f9202a444db48c5abb71020eeb00 | xMijumaru/GaddisPythonPractice | /Chapter 2/Gaddis_Chap2_ProgEX10_Ingredient/main.py | 486 | 4.125 | 4 | #this program will run the ingredients needed to produce cookies
amount=int(input('How many cookie(s) do you wish to make: '))
#this is the amount that makes 48 cookies
sugar=1.5/48.0
butter=1/48.0
flour=2.75/48.0
#reminder that // is int division and / is float division
print("Amount to make ",amount, " cookie(s)")
pr... | true |
fe5d02ecda6c3b78d3e3b418211ad508a60c000f | yms000/python_primer | /rm_whitespace_for_file.py | 820 | 4.15625 | 4 | #! /usr/bin/python
# -*- coding: utf-8 -*-
# rm_whitespace_for_file.py
# author: robot527
# created at 2016-11-6
'''
Remove trailing whitespaces in each line for specified file.
'''
def rm_whitespace(file_name):
'''Remove trailing whitespaces for a text file.'''
try:
with open(file_name, 'r+') as cod... | true |
02c841ac52ca32b61b87f71502f072c047ac38ea | BrothSrinivasan/leet_code | /cycle graph/solution.py | 1,534 | 4.1875 | 4 | # Author: Barath Srinivasan
# Given an unweighted undirected graph, return true if it is a Cycle graph;
# else return false. A Cycle Graph is one that contains a single cycle and every
# node belongs to that cycle (it looks like a circle).
# Notes:
# a cycle is only defined on 3 or more nodes.
# adj_matrix is an n-by... | true |
fa5ee033646904e358b3f504d3597831a5701336 | Tajveez/intermediate-python | /lists.py | 629 | 4.125 | 4 | myList = ["banana", "apple", "cherry"]
print(myList)
myList2 = list()
print(myList2)
myList3 = [5, True, "apple", "apple"]
print(myList3)
print(myList[2])
print(myList[-1])
for x in myList:
print(x)
if "banana" in myList:
print('Yes')
else:
print('No')
print(len(myList3))
myList.append("lemon")
myLis... | false |
a85e19425d0c1ca0e7d9907fb2d7421acdbfa71e | avneetkaur1103/workbook | /DataStructure/BinaryTree/tree_diameter.py | 1,342 | 4.1875 | 4 | """ Print the longest leaf to leaf path in a Binary tree. """
class Node:
def __init__(self, value):
self.key = value
self.left = self.right = None
def diameter_util(root):
if not root:
return 0, []
left_height, left_subtree_path = diameter_util(root.left)
right_height, right_subtree_path = diameter_util(r... | true |
3fd71c526ccbfcf4ab615d8615084924088c0c3e | natanisaitejasswini/Python-Programs | /OOP/underscoreduplicte.py | 997 | 4.5625 | 5 | """
map => Take a list and a function, and return the list you get by applying that function to every item in the list
filter => Take a list and return only the values when a given function is true
my_filter([1,2,3,4,5], lambda x: x%2==0) => [2,4]
reject => The exact opposite of filter
my_reject([1,2,3,4,5], la... | true |
4107b89ed8a9320e97038724aff412aad3bc84e4 | LVargasE/CS21 | /Extracurricular/OOP-Door-Example.py | 1,044 | 4.15625 | 4 | """ OOP example using doors
"""
class Door:
color = 'brown'
def __init__(self, number, status):
self.number = number
self.status = status
@classmethod
def knock(cls):
print("Knock!")
@classmethod
def paint(cls, color):
cls.color = color
... | false |
75b5e1c59aa553349af121218c3281442fa60a78 | shivakarthikd/practise-python | /single_linked_list.py | 1,615 | 4.28125 | 4 | class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class LinkedList:
# Function to initialize head
def __init__(self):
self.head = None
# This function prints contents of linked list
# starting from head
def printList(self):
... | true |
bddacb0f55e6d1b2332f6a48471ad8b0b31c51b6 | StRobertCHSCS/ics2o1-201819-igothackked | /life_hacks/life_hack_practice_1.3.py | 527 | 4.34375 | 4 |
'''
-------------------------------------------------------------------------------
Name: minutes_to_days.py
Purpose: converts minutes into days, hours, minutes
Author: Cho.J
Created: date in 22/02/2019
------------------------------------------------------------------------------
'''
#PRINT
minute= int(input("Ho... | true |
f680f5deb0653aa00c080a84d992f8bacb58d6d0 | StRobertCHSCS/ics2o1-201819-igothackked | /unit_2/2_6_4_while_loops.py | 276 | 4.34375 | 4 |
numerator = int(input("Enter a numerator: "))
denominator = int(input("Enter denominator: "))
if numerator // denominator :
print("Divides evenly!")
else:
print("Doesn't divide evenly.")
while denominator == 0:
denominator = int(input("Enter denominator: "))
| true |
7d05afce4800e027970c6523cb3f83abf677a020 | mihaivalentistoica/Python-Fundamentals | /python-fundamentals-master/09-flow-control/while-loop-exercise.py | 1,012 | 4.3125 | 4 | user_input = ""
# b. If the input is equal to “exit”, program terminates printing out provided input and “Done.”.
while user_input != "exit":
# a. Asks user for an input in a loop and prints it out.
user_input = input("Provide input: ")
# c. If the input is equal to “exit-no-print”, program terminates with... | true |
5f37a37f5b8d2ac55c0bdc1b6be249058c8b411e | ShivangiNigam123/Python-Programs | /regexsum.py | 381 | 4.1875 | 4 | #read through and parse a file with text and numbers. You will extract all the numbers in the file and compute the sum of the numbers.
import re
name = input ("enter file :")
sum = 0
fhandle = open(name)
numlist = list()
for line in fhandle:
line = line.rstrip()
numbers = re.findall('[0-9]+',line)
for num... | true |
5396067aa7a5580b864123469f232d1c7fce7369 | danbeyer1337/Python-Drill--item-36 | /item36Drill.py | 1,963 | 4.125 | 4 | #Assign an integer to a variable
number = 4
#Assign a string to a variable
string = 'This is a string'
#Assign a float to a variable
x = float (25.0/6.0 )
#Use the print function and .format() notation to print out the variable you assigned
print 'The variables are {0}, {1}, {2}'.format(number, strin... | true |
3506f85dcd5b448b4f0c009e1fa9a239dacc45ba | IamBikramPurkait/100DaysOfAlgo | /Day 3/Merge_Meetings.py | 1,451 | 4.25 | 4 | '''Write a function merge_ranges() that takes a list of multiple meeting time ranges and returns a list of condensed
ranges.Meeting is represented as a list having tuples in form of (start time , end time)'''
# Time complexity is O(nlogn)
def merge_meetings_time(meetinglist):
# Sort the meetings by start... | true |
41e0d6d733fba92c65018cb3df37ed00baf1eff3 | IamBikramPurkait/100DaysOfAlgo | /Day 4/FirstComeFirstServe.py | 1,258 | 4.21875 | 4 | # Recursive Approach
# Problem statement : Write a function to check if a restaurant serves first come , first serve basis
# Assumptions: 1)There are three lists dine_in_orders , take_out_orders , served_orders
# 2)The orders number will not be ordered and are randomly assigned
# 3)They are g... | true |
1e4d7b0f98b1d63b4bf82cb8f1b353176cc71c42 | IamBikramPurkait/100DaysOfAlgo | /Day1/Tower of Hanoi.py | 1,367 | 4.25 | 4 | ''' Problem Tower of Hanoi:
About: Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:
1) Only one disk can be moved at a time.
2) Each move consists of taking the upper disk from one of... | true |
c62c719c3585ce32b829726429725e03a650c4a5 | G1998P/SEII-GuilhermePeresSilva | /Semana02/prog018.py | 617 | 4.15625 | 4 | '''
ordenacao de lista
'''
# metodos sort e sorted
#sorted cria uma nova lista
#sort organiza a propria lista
l = [1,4,3,2,10,65,3]
l2 = sorted(l)
print(l2)
print(l)#l nao for ordenada
# l.sort()
# print(l)# l foi ordenada
t = tuple(l)
# tuiples nao possui o metodo sort
print(sorted(t))
# pode ser passado uma f... | false |
f93e10068776b3ab4e298bf55eae39598a38ec5d | indexcardpills/python-labs | /02_basic_datatypes/2_strings/02_09_vowel.py | 444 | 4.25 | 4 | '''
Write a script that prints the total number of vowels that are used in a user-inputted string.
CHALLENGE: Can you change the script so that it counts the occurrence of each individual vowel
in the string and print a count for each of them?
'''
#string=input("write a sentence: ")
string="the dog ate th... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.