This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isWordGuessed(secretWord, lettersGuessed): | |
''' | |
secretWord: string, the word the user is guessing | |
lettersGuessed: list, what letters have been guessed so far | |
returns: boolean, True if all the letters of secretWord are in lettersGuessed; | |
False otherwise | |
''' | |
# FILL IN YOUR CODE HERE... | |
return [False, True][lettersGuessed in secretWord] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gcdRecur(a,b): | |
if a>b: | |
a,b=b,a | |
if a==0: | |
return b | |
else: | |
return gcdRecur(b%a,a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gcdIter(a,b): | |
""" | |
make a program thake return | |
largest integer divides of two number | |
without using reminder or % syntex""" | |
if b<a: | |
a,b = b,a | |
c = a | |
while c>0: | |
if (a/c==a//c) and (b/c==b//c): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
count=0 | |
def printMove(fr,to): | |
global count | |
count+=1 | |
print('move from '+str(fr)+' to '+str(to)) | |
def Tower(n,fr,to,spare): | |
if n==1: | |
printMove(fr,to) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "conio.h" | |
int password(); | |
int pass_system(); | |
int main () | |
{ | |
if (!password()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <conio.h> | |
#include <windows.h> | |
int password(); | |
int pass_system(); | |
void printBoard(); | |
void change_player(); | |
void input(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define max 10 | |
int i=0; | |
int array[max]; | |
void printInstruction() | |
{ | |
printf("Press 1 for push\nPress 2 for pop\nPress 3 for display full list\nPress 4 for display top\nPress ctrl+z for exit\n"); | |
} | |
void push(int element) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main () | |
{ | |
int array [100]; | |
int maxi_index,j; | |
scanf("%d",&maxi_index); | |
array [maxi_index]; | |
for (j=0;j<maxi_index;j++) | |
scanf("%d",&array [j]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [] | |
i = (int) (input("How much element do you want : ")) | |
for element in range(i): | |
a.append((int)(input("> "))) | |
for element in range(1,i): | |
j = element | |
while j > 0 and a[j] < a[j-1]: | |
a[j-1],a[j]=a[j],a[j-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define max 5 | |
int rear=-1,front=-1,array[max]; | |
void printInstruction() | |
{ | |
printf("Press 1 for push\nPress 2 for pop\nPress 3 for display full list\nPress 4 for display top and last\nPress ctrl+z for exit\n\n"); | |
} | |
void push(int j) | |
{ |