Tag Archive : get

Play Rock Paper Scissors with Python

In this article, we have built a program that plays rock paper scissor, with the Python code. Please install python 3.8 from the link given below to run this code.
https://www.python.org/downloads/

I prefer you to use atom text editor to type your code or to save the given code:
https://atom.io/

You can download the the Play Rock Paper Scissors.py from GitHub using the given link:

Link for the code in GitHub

Example Input:

R

Output:

You Win!!!
~~CONGRATS~~
 You:R
 Computer:S

Example Input:

R

Output:

===========
====TIE====
===========

Example Input:

R

Output:

You Lose!!!
~~TRY AGAIN:-(~~
 You:P
 Computer:S

Example Input:

Something else

Output:

=====Error=====
Input Format: R
        or
Input Format: S
        or
Input Format: P

Code:

x = input().upper()
y = {'R','P','S'}.pop()
if (x=='R'and y=='S') or (x=='S' and y=='P')or(x=='P'and y=='R'):
   print(f"You Win!!!\n~~CONGRATS~~\n You:{x}\n Computer:{y}")
elif (y=='R'and x=='S') or (y=='S' and x=='P')or(y=='P'and x=='R'):
   print(f"You Lose!!!\n~~TRY AGAIN:-(~~\n You:{x}\n Computer:{y}")
elif x==y:print('===========\n====TIE====\n===========')
else:print('=====Error=====\nInput Format: R\n\tor\nInput Format: S\n\tor\nInput Format: P')

Code Explanation:

In this code, we get input from the user, which is turned to upper case using the function upper() to avoid case confusion.

In order to store a random value for y, we use pop() function to a set.

As per the conditions of the game, we use if, elif and else statement that prints “You Win!!!…” if user wins and “You Lose!!!…” if not.

If equal values are received from both the sides, the code prints out “TIE”.

If the user enters anything other than R,P or S, the code prints out the input format.

And now, our code works perfectly fine.

Conclusion:

The above article explains the Rock Paper Scissor game using python coding. If you want to download the code from GitHub, click here. If you have any questions or feedback on this, feel free to post in the comments section below.

How to promote Windows Server 2022 as Domain Controller

In this article, we are going to take a look at Domain controller installation and configuration of Active Directory domain services Role on Windows Server 2022 and promote Windows Server 2022 as Domain Controller.

The first step will be to install the ADDS binaries and then promote Windows Server 2022 to a Domain Controller.

In the first place install the Active Directory Domain Services role to the Windows server 2022.Log on to the server as Local Administrator and launch server manager and in the top menu select Add Roles and Features.

This will start the Add Roles and Features wizard and it will show the before you begin the instructions window. You can select Next and go to the next prompt.

Click Next

In the Select Installation Type, select Role-based feature-based installation

Click Next

Continue with the default selection on Select Destination Server as we are going to install it on the local server.

Click Next

On the Server Roles list click Active Directory Domain Services role.

When you select Active Directory Domain Services Role it will prompt for required Features to add and click Add Features.

As the Active Directory Domain Services and DNS Server roles are selected in the Add roles wizard.

Click Next

On the Features selection leave the default, click Next.

The next screen will outline the things to note about Active Directory Domain Services, you may go through this for your understanding.

Click Next.

The installation of Active Directory Domain Services and DNS role will be installed and you can view the installation progress.

A screenshot of a cell phone

Description automatically generated

The Active Directory Domain Services and Domain Services and DNS Server Roles are Installed, now you can close the AD Roles and Features Wizard this will return back to Server Manager

On the Server Manager select the notification icon and continue with post-installation configuration which is promoting the server as Domain Controller.

Select Notifications and click “Promote This server to a Domain Controller”

promote Windows Server 2022

This will start “Active Directory Domain Services Configuration Wizard”

Select Add a New Forest in the Select Deployment Operation options.

Type the domain name as you want.

Click Next.

promote Windows Server 2022

In the next screen leave the settings default and type password for “Directory Services Restore Mode”. This password is different from the Administrator login password. So you can type the password and keep it somewhere in the secured place.

promote Windows Server 2022

In the DNS options leave the default

Click Next

promote Windows Server 2022

By default, the NetBios name will be shown prefix of the Domain name and leave the default.

Click Next

promote Windows Server 2022

You may change the path of the Database, log and Sysvol folder, but you can leave it to default and Continue

Click Next.

promote Windows Server 2022

Go through the review Options

Click Next.

promote Windows Server 2022

The prerequisite check will verify the Domain Controller Operation, once completed you would get an All Prerequisite check passed green tick.

Click Next.

promote Windows Server 2022

The installation will complete the configuration and restart the server automatically.

promote Windows Server 2022

Once the server restarted, on the login screen type the administrator password which was used before and log in.

promote Windows Server 2022

Launch Server Manager and select Tools –> Active Directory users and computers, which will open Active Directory Users and Computers management console.

promote Windows Server 2022

You can add users, groups and other objects and start to using Active Directory Domain Services.

promote Windows Server 2022

The Windows Server 2022 Domain Controller Installation Completed Successfully.