Online -Python zum C -Konverter
console.log("Hello World!");
Good Grasshopper
console.log("Hello World!");
test=int(input())
for i in range(test):
k,x=map(int,input().split(' '))
print(k-x)
s=input()
so=''
for i in range(0,len(s),2):
so=so+s[i]
if(so[0]=='G'):
print(so.count('B'))
elif(so.count('G')==so.count('B')):
print(so.count('G'))
else:
print(so.count('G'))
#Importting csv module
import csv
#csv file name
filename= "aapi.csv"
# intiliaze titles and rows
fields =0
rows = 0
# reading csv file
with open(filename,'r') as csvfile:
# extract each data row one by one
csvreader=csv.reader(csvfile)
rows.append(rows)
# get total no of rwos
print("Total no of rows:%d%(csvreader.line_num)")
# print fields name
print('Field names are:' + ', '.join(field for field in fields))
# print first 5 rows
print('\n First 5 rows are:\n')
for row in rows[:5]:
# parsing each column of rows
for col in row:
print("%10s"%col),
print('\n')
a=[]
def knapsack(pro,wt,c,n,ans):
global a
if n==0 or c==0:
a+=ans,
elif wt[n-1]>c:
knapsack(pro,wt,c,n-1,ans)
else:
knapsack(pro,wt,c-wt[n-1],n-1,ans+pro[n-1])
knapsack(pro,wt,c,n-1,ans)
n=int(input())
profit=list(map(int,input().split()))
weights=list(map(int,input().split()))
capacity=int(input())
knapsack(profit,weights,capacity,n,0)
a.sort(reverse=True)
print(a[1 if a[0]<=10 and a[0]%3 else 0])
#Importting csv module
import csv
#csv file name
filename= "aapi.csv"
# intiliaze titles and rows
fields =0
rows = 0
# reading csv file
with open(filename,'r') as csvfile:
# extract each data row one by one
csvreader=csv.reader(csvfile)
rows.append(rows)
# get total no of rwos
print("Total no of rows:%d%(csvreader.line_num)")
# print fields name
print('Field names are:' + ', '.join(field for field in fields))
# print first 5 rows
print('\n First 5 rows are:\n')
for row in rows[:5]:
# parsing each column of rows
for col in row:
print("%10s"%col),
print('\n')
import random
from collections import defaultdict
def main_roll():
dice_amount = int(input("Enter the number of dice: ")) # Total Number of Dice Being Rolled
sides_of_dice = int(input("Enter the number of sides: ")) # Total Number of Sides per Die
rolls_of_dice = int(input("Enter the number of rolls to simulate: ")) # Total Number of Times Each Die Rolled
result = roll(dice_amount, sides_of_dice, rolls_of_dice) # This stores the results
maxH = 0 # Used for formulating
for i in range(dice_amount, dice_amount * sides_of_dice + 1):
if result[i] / rolls_of_dice > maxH: maxH = result[i] / rolls_of_dice
for i in range(dice_amount, dice_amount * sides_of_dice + 1):
print('{:2d}{:10d}{:8.2%} {}'.format(i, result[i], result[i] / rolls_of_dice, '#' * int(result[i] / rolls_of_dice / maxH * 40)))
def roll(dice_amount, sides_of_dice, rolls):
d = defaultdict(int)
for _ in range(rolls):
d[sum(random.randint(1, sides_of_dice) for _ in range(dice_amount))] += 1
return d
main_roll()
a=int(input())
b=int(input())
c=int(input())
if a>b and a>c:
print(a,"is larger")
elif b>a and b>c:
print(b,"is larger")
else:
print(c,"is larger")
if number == 2 : prime_con = True
if number>2 and number%2==0 : prime_con = False
stopper = math.floor(math.sqrt(number))
for j in range(3,100,2):
if number%j==0:
prime_con = False
break
asxxwdwdqwdqw