Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Number Guessing Game in Java #149

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions Number Guessing Game/game.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import java.util.Scanner;


public class game {

public static void main(String[] args) {
int num = 1+(int)(Math.random()*100);
int tot_trial = 10;
int my_trial = 1;
System.out.println("\n******** Welcome To The Game - Guess The Number ********\n");

while(my_trial <= tot_trial)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter any number between 1 and 100 : ");
int guess = sc.nextInt();

if(num==guess)
{
System.out.println("Congrats !!!");
System.out.println("The entered number matches with the random number");
System.out.println("\n******** Thank You For Playing The Game ********\n");
break;
}
else if(guess>num)
{
System.out.println("The entered number is greater than the random number");
}
else if(guess<num)
{
System.out.println("The entered number is smaller than the random number");
}

String str2 = String.format("This is your %d attempt", my_trial);
System.out.println(str2);
String str3 = String.format("You have %d attempts left\n", 10-my_trial);
System.out.println(str3);
if(my_trial==tot_trial)
{
System.out.println("You have exhausted all trials.");
System.out.println("The number was " + num);
System.out.println("Sorry... You Lost the game \n Try Again");
}
my_trial = my_trial + 1;
}


}

}
Binary file added Number Guessing Game/img1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Number Guessing Game/img2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions Youtube Video Downloader/Youtube_Downloader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from tkinter import *
from pytube import YouTube

root = Tk()
root.geometry('500x300')
root.resizable(0,0)
root.title("YTD")

Label(root,text = 'Youtube Video Downloader\nBy Romil Jain', font ='arial 15 bold').pack()

link = StringVar()

Label(root, text = 'Paste Link Here:', font = 'arial 15 bold').place(x= 160 , y = 60)
link_enter = Entry(root, width = 70,textvariable = link).place(x = 32, y = 90)

def Downloader():
url =YouTube(str(link.get()))
video = url.streams.get_highest_resolution()
# video.download('C:/Users/hp/Downloads')
video.download('Downloads')
Label(root, text = 'DOWNLOADED', font = 'arial 15').place(x= 180 , y = 210)

Button(root,text = 'DOWNLOAD', font = 'arial 15 bold' ,bg = 'pale violet red', padx = 2, command = Downloader).place(x=180 ,y = 150)

root.mainloop()