Share your repls and programming experiences

← Back to all posts
PyMiniPhone
TheBorg0919 (28)

This is a simple phone-ish kind of program. You can use a calculator, play a guessing game, or log something on it. I'm learning Python, so I decided to make this small project as kind of a landmark of my progress on learning Python.

Commentshotnewtop
AdCharity (944)

would add some sort of loop to continue after doing a task

PantheraLeo04 (1)

try using replit.clear() to erase the terminal and random.randint() to have the user guess a random word

To all the people telling me to use os, I never learned the os module only replit

JacksonCowie (209)

@PantheraLeo04 Better to import the os module and use os.clear(), just makes it compatible for desktop.

TaylorLiang (656)

@JacksonCowie finally, somebody that agrees that os is superior

Warhawk947 (257)

@TaylorLiang you could also do os.system('cls' if os.name == 'win' else 'clear')

TaylorLiang (656)

@Warhawk947
Dont use win, use nt instead.

Warhawk947 (257)

@TaylorLiang ok (I thought it was win I never tested it oof)

Thecrowbar1234 (63)

@JacksonCowie I usually use replit clear, but i would recommend os clear

Ganesha1 (7)

I made something similar to this in batch.

Code

@echo off
color 0a
cls
title Booting up...
echo Finding System Disk...
ping n-127.0.0.1>nul
ping n-127.0.0.1>nul
echo Found Operating System Boot Disk
echo Starting up...
echo Starting up... 1 percent
echo Starting up... 5 percent
echo Starting up... 10 percent
echo Starting up... 15 percent
echo Starting up... 20 percent
echo Starting up... 25 percent
echo Starting up... 30 percent
echo Starting up... 35 percent
echo Starting up... 40 percent
echo Starting up... 45 percent
echo Starting up... 50 percent
echo Starting up... 75 percent
echo Starting up... 95 percent
echo Starting up... 100 percent!
goto login
pause
:login
cls
echo What is your Password?
set /p pword=

cls
echo Hello there!
echo Open a program:
echo 1 is for calculator
echo 2 is for clock
echo 3 is for antivirus
echo 4 is for browser
echo 5 is for text editor
echo 6 is for zombie attack.
set /p desktopick= Type Number Here:
if %desktopick%==1 goto calc
if %desktopick%==2 goto clock
if %desktopick%==3 goto antivirus
if %desktopick%==4 goto browser
if %desktopick%==5 goto textedit
if %desktopick%==6 goto zombiegame
:calc
cls
@echo off
title CMD Calculator
color 1f
:top
echo -------------------------------------------
echo Welcome to CMD Calculator
echo -------------------------------------------
echo.
set /p sum=
set /a ans=%sum%
echo.
echo = %ans%
echo -------------------------------------------
pause
cls
echo Previous Answer: %ans%
goto top
pause
exit
:clock
cls
echo.
echo Time: %time%\
echo.
ping -n 2 0.0.0.0>nul
goto main
:antivirus
@echo off
title Antivirus
echo Antivirus
echo created by Ganesha

:start
IF EXIST virus.bat goto infected
IF NOT EXIST virus.bat goto clean
cd c:\windows\system32
:Infected
echo VIRUS DETECTED!
del virus.bat
pause
goto start
:browser
@echo off
:loop
color 7
cls
echo Welcome to Ion Browser
echo.
echo Type a URL below.\
set /p sitename=
start %sitename%
pause
goto loop
pause
:textedit
@echo off
echo Text generator!!!
echo -----------------
echo Type in your text
set /p text=
echo Your text is:
echo %text%
echo -----------------
echo Just copy and paste your text into notepad.
start notepad.exe
pause
:zombiegame
@echo off
:a
cls

title Zombie Attack
echo Welcome to Zombie Attack!
echo In this game you have to fight zombies.
echo (1) Begin

set /p choice1=Choose-
if %choice1% == goto g

:g
cls
title Battle
echo Entering Battle...
pause
cls
echo You find a strange man in the woods,
echo you think that he is just a man, but really, he's a zombie!
echo Entering Battle...
pause
goto h
:h
cls
title Battle
echo Zombie uses Bite!
your health fell by -shp
echo You have 3 attacks
echo (1) Punch
echo (2) Slap
echo (3) Kick in the butt

set /p choice2=choose-
if %choice2% == 1 goto i

if %choice2% == 2 goto j
if %choice2% == 3 goto k
:i
cls
echo You used Punch.
echo zombie's health fell by 14hp!
echo Congrats!
echo You beat the zombie!
:j
cls
echo You used Slap.
echo zombie's health fell by 8hp!
echo Congrats!

echo You beat the zombie!
:k
cls
echo You used Kick in the butt.
echo zombie's health fell by 18hp!
echo Congrats!
echo You beat the zombie!

DmitryBolsoni (0)

Should of called it a pYphone

Unorthodox (8)

For the guessing game, I suggest you make an array or tuple containing a list of animals, then use random.choice() from the random module to choose a random one out of that list. Also, write a while loop to keep running the phone after you use one of its functions, and add an option to break out of that loop.

TheBorg0919 (28)

@Unorthodox thats a great idea but im learning python so i might add that in the future?