but how do you actually write this….?

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Boss: You get paid by the number of lines you write.
Me:

teggolT
Автор

Efficientely writing inefficient programs is a true software engineer skill

Ironpecker
Автор

Dude, this is literally half of the yandere simulator code

MCChubbyUnicorn
Автор

Modulo exists.
"Yeah, we're using it to not use it." 🤣

XthZ
Автор

well, the official vscode channel just shows us how to make a joke, teach programming, and introducing their product and settings at the same time
nice video lmao

RedSunsGaming
Автор

%: What is my purpose.
The original video: percentage.
%: oh my god

sponTheGam
Автор

num = int(input("> ")) #int defined here so if the user inputs a string it will error here instead of further in the code, don’t worry about it.

if num % 2 == 0:
print("even")
else:
print("odd")

Just a simpler way, but it’s awesome to see the concepts you are trying to teach in your version!

For people who don’t know, the % operator in python works like this:
12 / 5 = 2.4 —> 12 / 5 = 2r2

% instead of dividing normally, it will divide the number on the left by the number on the left the most amounts of times with the right it can without getting a fraction/decimal, then give you the remainder left that couldn’t be divided.

2 % 2 is 0
3 % 2 is 1
4 % 2 is 0

In mathematics this is known as a modulus or mod operation.

terminatorfishstudios
Автор

This is the most inefficient, efficient way to do this 😂

super_
Автор

I learned thia I my today's python class:)


N=int(input("Enter the no."))
Count=0
for i in range(1, N+1, 1):
Count=Count+1
If(i%2==0):
print("Even no.=", i)
else:
print("Odd no.= ", i)

Print(Count)

JaatSamajj
Автор

Bro that code was so awful that my dad came back just to mock it💀

cahydra
Автор

No.
a=int(input(“Insert your number here…”)
if a%2 == 0
print(“Even number inserted.”)
else
print(“Odd number inserted.”)
Kinda hard to type it in on my phone, but I hope you get the point.

fmis
Автор

I feel like the best way would be to have a for loop that starts at 1 and increases by 2 each pass. Then print i is odd, and i+1 is even.

Obviously any of these ways are dumb but, lol.

logank
Автор

this particular program is silly, but when I have to do repetitive things that look vaguely like this I use a multi-caret editor until it really becomes worth it to write the generator code. way less to think about, usually way easier and faster to crank out. a lot of programming really can be muscle memory, if you let it.

blarghblargh
Автор

Please don't do the last step!

When running the program, use redirection, eg. 'echo 1234 > file.txt'

kadensharpin
Автор

Modulus: "Am I a joke to you?"

andrewbao-vietnguyen
Автор

for i in range(10000):
if i % 2 == 0:
print(f"{i} is even")
else:
print (f"{i} is odd")

marcuzie
Автор

I get that this whole program could be substituted for
while x < 10000:
if x%2:
print("even")
else:
print("odd")
Its actually showing you how to use regular expressions to create large glossaries of code if you need to manually create a goto library for frequent reference

lguthrie
Автор

Rather than copy-pasting, you could simply pipe the command output into the file.

michelles.
Автор

Rather then changing the terminal settings we can also dum the result in a txt file and copy from their.

I call this a clean way

Nikhil-Tomar
Автор

This is like precomputing all your trig tables for video game math, crazy

andrewferguson