text stringlengths 5 121k |
|---|
numbers = []
for a in range(2,101):
for b in range(2,101):
print(str(a) + " " + str(b))
numbers.append(a ** b)
print("Removing repeats")
numbers = sorted(set(numbers))
print(str(len(numbers)))
|
time = int(input())
speed = int(input())
print('{:.3f}'.format((time * speed) / 12))
|
import random, sys
firstnames = ['Bobby','James','Kevin','Lisa','Mary','Diane','Joan','Garret','Sila','Gordon','Michael','David']
lastnames = ['Johnson','Hunt','Katz','Marley','Roberson','Smith']
class Person():
population = 0
def __init__(self, first = None, last = None, age = None):
if(first an... |
from .utils import flatten_list, set_default_dates
class Column(object):
def add_to_report(self, report, key, dictionary):
pass
class Report(object):
"""
A report was found to be a useful callable for more complicated aggregate reports, in which each
column of the report is a complicated que... |
import openpyxl
wb = openpyxl.load_workbook('F:\\python\\example.xlsx')
wb2 = openpyxl.Workbook()
sheet1 = wb.active
sheet2 = wb2.active
column_maxnum = sheet1.max_column
row_maxnum = sheet1.max_row
for column_num in range(1, column_maxnum+1):
for row_num in range(1, row_maxnum+1):
sheet2.cel... |
import openpyxl, sys
from openpyxl.styles import NamedStyle, Font
if len(sys.argv) > 1:
N = int(sys.argv[1])
wb = openpyxl.Workbook()
sheet = wb.active
default_bold = NamedStyle(name='default_bold')
default_bold.font = Font(bold=True)
for row_num in range(2, N+2):
sheet.cell(row = row_num, c... |
'''
Create a Mad Libs program that reads in text files and lets the user add
their own text anywhere the word ADJECTIVE, NOUN, ADVERB, or VERB
appears in the text file.
The program would find these occurrences and prompt the user to
replace them.
The results should be printed to the screen and saved to a new tex... |
class Fraction(object):
"""
A number represented as a fraction
"""
def __init__(self, num, denom):
""" num and denom are integers """
assert type(num) == int and type(denom) == int, "ints not used"
self.num = num
self.denom = denom
self.reduce()
def reduce(s... |
"""
Create 2D Matrix bitmpap from Ferag String.
"""
import re
import os.path
import argparse
import codecs
from PIL import Image
PATTERN = r"\{SK\|(\d+)\|(\d+)\|(\d+)\|([\s\S]+)\}"
FONT = []
parser = argparse.ArgumentParser()
parser.add_argument('file', nargs='?', default='2DMatrix.bin')
args = parser.parse_args()
... |
from pandas import Series
s1=Series([88,60,75],index=[1,2,3])
print(s1)
print(s1.reindex([1,2,3,4,5]))
print(s1.reindex([1,2,3,4,5],fill_value=0))
|
import pandas as pd
df = pd.DataFrame({'a':[1,2,3,4,5], 'b':[(1,2), (3,4),(5,6),(7,8),(9,10)]})
print(df)
df[['b1', 'b2']] = df['b'].apply(pd.Series)
print(df)
|
import random
print('''\t\t\t\t\t\t\t\t### --- CODEBREAKER --- ###
\t\t\t\t\t1. The computer will think of 3 digit number that has no repeating digits.
\t\t\t\t\t2. You will then guess a 3 digit number
\t\t\t\t\t3. The computer will then give back clues, the possible clues are:
\t\t\t\t\tClose: You've guessed a corre... |
import datetime
from datetime import date
from dateutil.relativedelta import relativedelta
start_date = date(1901, 1, 1)
print(start_date)
end_date = start_date + relativedelta(years=99, days=365)
delta = datetime.timedelta(days=1)
print (end_date)
d = start_date
sunCount = 0
while d <= end_date:
if d... |
fullList = []
count = 0
def swap (v=[], i=0, j=0):
t=0
t = v[i]
v[i] = v[j]
v[j] = t
def perm (v=[], n=0, i=0):
j=0
if i == n:
num = ''
for j in range(0,n):
num = num + str(v[j])
fullList.append(int(num))
else:
... |
def average(array):
count=0
n1=0
s1=set(array)
for item in s1:
count+=item
n1+=1
return count/n1
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
result = average(arr)
print(result)
|
n=int(input())
for i in range(n):
name=str(input())
mylist=list(name)
result=("".join(mylist[::2]))
result2=("".join(mylist[1::2]))
print(result+" "+result2)
|
n=input()
students = set(map(int,input().split()))
b=input()
b1=set(map(int,input().split()))
print(len(students.union(b1)))
|
import numpy as np
import argparse
import cv2
ap = argparse.ArgumentParser()
ap.add_argument('-i', '--image', required=True, help='Path to the image.')
ap.add_argument('-t', '--threshold', type=int, default=128, help='Threshold value.')
args = vars(ap.parse_args())
image = cv2.imread(args['image'])
image = cv2.cvtCol... |
import cv2
class ShapeDetector:
def __init__(self):
pass
def detect(self, c):
shape = 'Unknown'
peri = cv2.arcLength(c, True)
approx = cv2.approxPolyDP(c, 0.04*peri, True)
if len(approx) == 3:
shape = 'Triangle'
... |
import pylab as plt
from matplotlib.animation import FuncAnimation
fig = plt.figure(figsize=(3, 3))
x, y = 0, 2
v = 0
p = plt.scatter(x, y, s=500)
plt.plot([-1, 1], (-0.25, -0.25))
dt = 0.1
g = 1
def update(frame_index):
global y, v
need_time = ((v * v + 2 * g) ** 0.5 - v) / g
need_time = m... |
"""
cbook即为cookbook,是一些小工具组成的库
"""
from matplotlib.cbook import CallbackRegistry
callbacks = CallbackRegistry()
sum = lambda x, y: print(f'{x}+{y}={x + y}')
mul = lambda x, y: print(f"{x} * {y}={x * y}")
id_sum = callbacks.connect("sum", sum)
id_mul = callbacks.connect("mul", mul)
callbacks.process('sum', 3, 4)
callb... |
from order import Order
class OrderList(object):
def __init__(self):
self.headOrder = None
self.tailOrder = None
self.length = 0
self.volume = 0
self.last = None
def __len__(self):
return self.length
def __iter__(self):
self.last = self.headOrder
return self
def next(self):
if self.last == ... |
from bs4 import BeautifulSoup
soup = BeautifulSoup('<p>Hello</p>','lxml')
print(soup.p.string)
print()
html='''
<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title" name="dormouse"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and th... |
def parse_input(filename):
rules = {}
with open(filename) as f:
for line in f:
bag, spec = line.strip(".\n").split(" bags contain ")
bag_rules = {}
if spec != "no other bags":
for part in spec.split(", "):
part = part.split()[:-1]... |
def main():
input = [line.strip().split() for line in open("input/day2.txt")]
x, y = 0, 0
y2, aim = 0, 0
for direction, units in input:
units = int(units)
if direction == "forward":
x += units
y2 += units * aim
if direction == "up":
y -= units... |
medida = float(input('Digite a Medida em Kilometros \n' ))
cm = medida*100
mm = medida*1000
dc = medida/100
hc = medida/1000
print('A medida de {:.1f}km coresponden a {:.1f}cm , {:.1f}mm, {} Devimetros,{} Hectometros. '.format(medida, cm, mm, dc, hc))
|
"""
Name : Pratik Gorade
Year : T.Y. B.Tech
Panel : 2
Batch : B2
Roll No. : PB02
Usage : python3 rsa_implementation.py
"""
from math import sqrt
from itertools import count, islice
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a%b)
def isPrime(n):
if n < 2:
ret... |
"""
Tut1 - Classes and Instances
"""
class Employee:
def __init__(self,first,last,pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + '.' + last + '@company.com'
def fullname(self):
return '{} {}'.format(self.first, self.last)
emp1 = Employe... |
from math import sin, cos, sqrt, atan2, radians
def calculate_distance(lon1: float, lat1: float, lon2: float,
lat2: float) -> float:
"""
Calculate the distance in meters between the two given geo locations.
Args:
lon1: Longitude from -180 to 180
lat1: Latitude from ... |
n1 = int(input("Input int "))
n2 = 0
while n1 > 0:
digit = n1 % 10
n1 = n1 / 10
print (n1)
n2 = n2 * 10
n2 = n2 + digit
print (n2)
|
def leap_year(y):
return y%4 == 0 and y%100 != 0 or y%400 == 0
k = int(input())
print(leap_year(k))
|
k = [None, '+', '+', '+', '-', '+' ]
lst = []
c = 0
for i in k:
if i:
c = eval(str(c)+i+'1')
lst.append(c)
print(lst)
|
def substring_anagram(dictionary: list, sub: list) -> None:
dictionary_sort = list(map(sorted, dictionary))
sub_sort = map(sorted, sub)
m = []
for i in sub_sort:
m.append(dictionary_sort.count(i))
return m
all_word = eval(input())
query = eval(input())
out_list = substring_anagr... |
def fact(n):
if n==1 or n==0:
return 1
else:
return n*fact(n-1)
x=fact(5)
print(x)
|
n=5
fact=1
for i in range(0,n,-1):
if i==1 or i==0:
fact=fact*1
else:
fact=fact*i
print(fact) |
y=int(input('enter any year : '))
if (y % 4 == 0):
if (y % 100 == 0):
if (y % 400 == 0):
print('leap year')
else:
print('not a leap year')
else:
print('leap year')
else:
print('not a leap year')
|
def multiple(list):
mul = 1
for i in list:
mul =mul * i
print(mul)
list=[8,2,3,-1,7]
multiple(list) |
def prime(num):
for i in range(2,num//2):
if num % i == 0:
print("not prime")
break
else:
print("prime")
num=int(input("enter any number : "))
prime(num) |
st=("input:"," , ")
print(st)
|
char = " abcde"
y=char.split()
print(y)
char=char[-1::-1]
print(char) |
a=[int(b) for b in input("enter the number : ").split()]
print("smallest number",min(a))
print(a)
|
x = int(input('INPUT :'))
if x < 0:
y=x*(-1)
print(y)
else:
print(x) |
n = int(input("enter any number : "))
sum = 0
for i in range(1,n+1):
sum = sum + i
print(sum) |
powers = []
for pow in range(15, -1,-1):
powers.append(2 ** pow)
binaryOutput = ''
while True:
decimalInput = int(input('Enter a number between 1 and 65535: '))
if decimalInput <= 65535 and decimalInput >= 1:
for power in powers:
binaryOutput = binaryOutput + str(decimalInput // power)
... |
import random
class Date(object):
def getDate(self):
return '09-02-18'
class Time(Date):
def getTime(self):
return '07-07-07'
dt = Date()
print(dt.getDate())
tm = Time()
print(tm.getTime())
print(tm.getDate())
class Animal(object):
def __init__(self, name):
self.name = n... |
class Component:
def __init__(self, name, emp_id):
self.name = name
self.emp_id = emp_id
def print_name(self):
print('Name of Employee: ' + self.name)
def print_id(self):
print('ID of Employee: ' + str(self.emp_id))
class Manager(Component):
de... |
def intToBin(num):
powers = []
for pow in range(255, -1,-1):
powers.append(2 ** pow)
binaryOutput = ''
for power in powers:
binaryOutput = binaryOutput + str(num // power)
num %= power
return binaryOutput
class Solution(object):
def hammingDistance(self, x, y):
... |
"""
Created on Fri Sep 25 18:08:04 2020
@author: ARYA SHANKAR
"""
list=[]
n=int(input("Enter the number of elements : "))
for i in range(1,n+1):
a=int(input("Enter the %d element :" %i))
list.append(a)
print("The list of positive numbers are : ")
for num in range(n):
if(list[num]>=0):
... |
sigma = 0.1
x1 = (1, 5)
x2 = (2, 4)
p = 5
initial_w1 = 0
initial_w2 = 0
def delta(y, p):
return int(p - y)
def func(w1, w2, point):
return point[0] * w1 + point[1] * w2
def update(w, x, delta):
return w + delta * x * sigma
def check(w1, w2):
y1 = func(w1, w2, x1)
y2 = func(w1, w2, x2)
return (y1 > p) ... |
class Solution(object):
def swapPairs(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
root = prev = ListNode(1)
root.next = head
while prev.next and prev.next.next:
cur = prev.next
cu... |
class Solution(object):
def copyRandomList(self, head):
"""
:type head: RandomListNode
:rtype: RandomListNode
"""
hm = {}
root = newcur = RandomListNode(1)
cur = head
while cur:
newNode = RandomLis... |
class Solution(object):
def validPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
"""
:type s: str
:rtype: bool
"""
i = 0
j = len(s) - 1
allowOnce = 0
while i <= j: ... |
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
if not headA or not headB:
return None
aLen = self.getLength(headA)
bLen = self.getLength(headB)
... |
"""
The knows API is already defined for you.
@param a, person a
@param b, person b
@return a boolean, whether a knows b
you can call Celebrity.knows(a, b)
"""
class Solution:
def findCelebrity(self, n):
res = 0
for i in range(1,n):
if Cele... |
class Solution(object):
def levelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if not root:
return []
self.res = []
self.dfs(root,0)
return self.res
def dfs(self,root,step):
... |
from threading import Thread
import time
def test1():
g_num = 100
g_num += 1
print(" test 1 g_num is %d"%g_num)
def test2():
g_num = 1
print(" test 2 g_num is %d"%g_num)
p1 = Thread(target=test1)
p1.start()
p2 = Thread(target=test2)
p2.start()
|
class myClass1:
"""A simple example class"""
def __init__(self):
self.data = []
i = 12345
def f(self):
return 'what fuck'
class A:
pass
class myClass2:
def __init__(self, r, i):
self.r = r
self.i = i
x = myClass1()
print(x.f())
|
class ShortInputException(Exception):
def __init__(self,first,last):
self.first = first
self.last = last
def main():
try:
s = "an"
if len(s) < 3:
raise ShortInputException(len(s),3)
except ShortInputException as res :
print(res)
else:
print("no exception")
main() |
class TreeNode(object):
def __init__(self,x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def insert(self, root, val):
if root == None:
root = TreeNode(val)
return root
else:
if val > root... |
import random
word1 = ["crunchy", "soft", "supreme", "beefy", "nacho", "beefy 5-layer", "cheesy", "nacho cheese", "spicy", "mild"]
word2 = [" chicken", " bean", " black bean", " nacho", " doritos locos", " gordita"]
word3 = [ " taco", " burrito"," chalupa", " quesadilla", " bellgrande", " supreme", " crunchwra... |
list=input("Please Enter Your List = ")
output=[]
output = [n for n in list if n not in output]
print("Your Requested List : ", ''.join(output))
print("Thank You")
|
b=float(input("Enter the Base of the Triangle = "))
h=float(input("Enter the Height of the Triangle = "))
a=.5*h*b
print("Area of the Triangle is",a)
print("Thank You")
|
a=int(input("Please Enter Your Number = "))
b=int(input("Please Enter Your Number = "))
sum=0
for i in range(a,b+1):
fact=1
for j in range(1,i+1):
fact=fact*j
print("Factorial of ",j," = ",fact)
sum=sum+fact
print("Sum of Factorials = ",sum)
print("Thank You")
|
a=int(input("Please Enter The Year = "))
if a%4==0:
print(a," Is A Leap Year")
else:
print(a,"Is Not A Leap Year")
|
a=int(input("Please Enter Your Binary Number = "))
j=1
o=0
while True:
if a<1:
break
else:
s=a%10
o=o+s*j
a=a//10
j=j*2
print("Your Decimal Number : ",o)
|
import numpy as np
def binary_encode(i, num_digits):
return np.array([i >> d & 1 for d in range(num_digits)])
def fizz_buzz_encode(i):
if i % 15 == 0:
return np.array([0, 0, 0, 1])
elif i % 5 == 0:
return np.array([0, 0, 1, 0])
elif i % 3 == 0:
return np.array([0, 1, 0, 0])... |
"""
DRIVER.PY TAKES A TEXT FILE AS INPUT, AND FOR EACH STRING
WILL CHECK ALL FUNCTIONS TO FIND A VALID TOKEN
"""
from perl import validateToken_Perl
from javastring import validateToken_JavaString
from cint import validateToken_cInt
from cchar import validateToken_cChar
from cfloat import validateToken_cFloa... |
def text_check(some_text):
for symbols in some_text:
if not symbols.isalpha():
raise NameError(symbols, 'не являеться буквой')
if len(some_text) < 3:
raise NameError('Имя или фамилия не должны быть такими короткими')
return some_text
class Person:
def __init__(self... |
class node:
def __init__(self, data = None, next = None):
self.data = data
self.next = next
class singlyLinkedList:
def __init__(self):
self.start = None
def displayList(self):
print("-----------------------------------------")
if self.start == None:
... |
class node:
def __init__(self, data = None, next = None):
self.data = data
self.next = next
class stack:
def __init__(self, size=5):
self.top = None
self.size = size
self.length = 0
def display(self):
print("--------------------------------------------")
... |
class node:
def __init__(self, prev=None, data=None, next=None):
self.prev = prev
self.data = data
self.next = next
class queue:
def __init__(self):
self.start = None
self.end = None
def display(self):
print("---------------------------------------------... |
from datetime import datetime
from math import sin, cos, radians
import pygame
class Clock:
def __init__(self, width=640, height=480):
self._width = width
self._height = height
def run(self):
self._startup()
while self._running:
self._input()
self._updat... |
message = 'It was a bright cold day in April, and the clocks were striking thirteen'
count = {}
for character in message:
count.setdefault(character, 0)
count[character] = count[character] + 1
print(count) |
a=[]
print("Enter the no of test cases: ")
tests = int(input())
for test in range(tests):
print('Enter the array size:')
n = int(input())
print('Enter array elements:')
for i in range(n-1):
no = int(input("num:"))
a.append(int(no))
lisum = int(sum(a))
sum=int(n*(n+1)/2... |
def total(a=5, *numbers, **phonebook):
print ('a', a)
for single_item in numbers:
print('single_item', single_item)
for first_part, second_part in phonebook.items():
print(first_part, second_part)
total(10, 1, 2, 3, Jack=1123, John=2231, Inge=1560)
|
def alphabet_position(text):
alphabet_numbers = []
for letra in text:
if type(letra) == str:
x = ord(letra.lower()) - 96
if '-' in str(x):
pass
else:
alphabet_numbers.append(x)
else:
pass
listToStr = '... |
import itertools
import collections
from functools import reduce
from typing import List
KakuroData = collections.namedtuple('KakuroData', 'sum length factors')
combinations: List['KakuroData'] = []
Style = collections.namedtuple('Style', 'text background')
def find_combinations():
numbers = [1, 2, 3, 4, 5,... |
'''These are the things used in making and using controllers.
'''
import imp
import os
class Controller(object):
"""Controllers take data from some files, do stuff with it,
and write it to the build directory."""
def __init__(self, site, data, destination, templates="_templates"):
... |
def invertePalavra(palavra):
"""
Funcao que retorna parte final da palavra invertida
"""
comprimento = len(palavra)
palavra_invertida = palavra[::-1]
nova_palavra = ""
for letra in palavra_invertida:
if letra == " ":
pass
else:
nova_palavra = nov... |
days = int(input())
for i in range(1, days+1):
print("%s Abracadabra" %i)
|
import Cinema_Functions
restart = ['Yes', 'YES', 'Y', 'yes']
while restart not in ['NO', 'No', 'no', 'N', 'nO', 'n']:
choice1 = int(input('1.Yearly Collection Of All Branchesn\n2.Quaterly Collection(Gross)\n'
'3.Quaterly Collection(Branch Wise)\n4.Performance of a Branch on given Date Ra... |
import matplotlib.pyplot as plt
import csv
import numpy as np
import pandas as pd
df = pd.read_csv("D.csv")
df.head()
df.plot.bar(x='Condition',y=['Before','After'])
plt.show() |
import datetime
import math
MJD_JD_CONVERSION_VALUE = 2400000.5
LONGITUDE_MINUTES_VALUE = 4.0
DEFAULT_DATE_FORMAT = "%Y-%m-%d"
AUTO_CONVERSION_JD_MJD_VALUE = 1721060.5
def find_corresponding_night(JD: float, Lon: float) -> datetime:
"""
From range [0,AUTO_CONVERSION_JD_MJD_VALUE] JD is treated as MJD (years... |
def main():
print("This program evaluates the square root of 2 using Newton's Method")
root = 2
x = eval(input("Enter number of iterations: "))
for i in range(x):
root = root - (root**2 - 2)/(2*root)
print(root)
main()
|
""" """
class BankAccount():
def __init__(self, balance):
if balance <= 0:
raise ValueError('Balance less than 0.')
self.balance = balance
def withdraw(self, amount):
if self.balance < amount:
raise ValueError('You have too little money.')
if amount < 0... |
txt = 'Hello World'
print(80*"=")
print(len(txt))
print(txt[10])
print(txt[2:5])
print(txt[:5]+'World')
print(txt.upper())
print(txt.lower())
print(txt.replace("H", "J"))
print(80*"=")
print("============>>>>> LATIHAN 2")
print("______________________________")
umur = 20
txt = 'Hello, nama say... |
"To string Function"
def to_str(n: float) -> str:
"""
--------------
METHOD: to_str
--------------
Description:
Method that returns an string from
a float stored in @n:
"""
return str(n)
|
"""Async Generator"""
import random
import asyncio
from typing import Generator
async def async_generator() -> Generator[float, None, None]:
"""
-----------------------
METHOD: async_generator
-----------------------
Description:
Generates and returns a float
n number of times to ... |
desc = [8, 7, 6, 5, 4, 3, 2, 1]
asc = [1, 2, 3, 4, 5, 6, 7, 8]
p = list(map(int, input().split(" ")))
isAsc = True
isDesc = True
for i in range(len(p)):
if isAsc:
if p[i] != asc[i]:
isAsc = False
if isDesc:
if p[i] != desc[i]:
isDesc = False
if isAsc:
pri... |
class Account:
ID = 1
counter = 0
def __init__(self, initial_deposit):
self.balance = initial_deposit
def withdraw(self, amount):
for i in range(0, 3):
check = int(input("What is your account ID? : "))
if not check == self.ID:
self.counter += 1
... |
"""/segmentation_with_channel_regularization/utils/visualization.py
Helper utiliities for visualizing images and segmentations.
"""
import numpy as np
from PIL import Image
def black_to_transparency(img):
"""Convert black pixels to alpha."""
x = np.asarray(img.convert('RGBA')).copy()
x[:, :, 3] = (255 *... |
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
if l1 == None:
return l2
if l2 == None:
return l1
node = List... |
import collections
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def levelOrder(self, root: TreeNode) -> List[List[int]]:
if not root: return []
tree_nodes = collections.deque([root]... |
from manimlib.imports import *
def doubling_line(x):
return 2*x
def hidden_flat_line(x):
return 0
def parabola(x):
return x**2
class LinearIsInvertible(GraphScene):
CONFIG = {
"x_min" : -5.5,
"x_max" : 5.5,
"y_min" : -11,
"y_max" : 11,
"graph_origin" : ORIGIN... |
'''
Basic approach : O(n2) => check for each character and add its count to a hashmap. At the end get all even counts and check if odd count value keys are also present
Optimized approach: The main idea of this approach is to maintain a set of characters. Add the character to hashset if its not ... |
a = input().lower()
b = input().lower()
if a < b:
print('-1')
elif a > b:
print('1')
else:
print('0') |
def main():
index = int(input("Enter the index: "))
a = 0
b = 1
n = 1
suma = 0
while n <= index:
n = n + 1
a = b
b = suma
suma = a + b
print(suma)
if __name__=='__main__':
main()
|
sentence = ' once said,"A person who ... new."'
name = "albert einstein"
print(name.title()+sentence)
name1 = "\tSmith Cooper\t"
print(name1.strip())
|
anwser = 17
if anwser != 42:
print("That is not the correct anwser. Please try again!")
StringArr = ['a','h','r','g','n']
print('h' in StringArr)
arr1 = 'k'
if arr1 not in StringArr:
print(arr1.title()+" is a good boy.")
|
class Car():
"""一次模拟汽车的简单尝试"""
def __init__(self,make,model,year):
self.make = make
self.model = model
self.year = year
self.odometer_reading = 0
def get_descriptive_name(self):
"""返回整洁的描述性信息"""
long_name = str(self.year)+' '+self.make+' '+self.model
return long_name.title()
def read_odometer(s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.