Really need some advice /u/Heyall1478 Python Education

Really need some advice /u/Heyall1478 Python Education

Hey everyone . Almost 2 month ago I started pt penetrating online course .

First , network fundamentals went great got 96 in the test. Then , Linux fundamentals again went great 98 in the test.

Now Python..I feel like a stupid who can’t think properly . Learned about if, else, elife, list, and set . I understand the logic of everything I really do. And The basic behind it and what everything does.

But when it comes to combine those things ? Like when I need to solve some exercise? I’m stupid as hell I swear it’s like my mind is going blank and I don’t even know where to start. Like I put the first input and then BOOM . Don’t know where to go and what to write . Keep forgetting things , even the small ones who can help me with exercises

I can sit hours on reading the same things, I can practice and practice but still nothing when it comes to combining . I had up until now like 5 exercises, one I managed to solve alone , the rest i got frustrated and watch the teacher solve it . Something’s i say “yep we learned it why I didn’t think about it “ Sometimes “how the hell i should have known ?” And then after some times I’m like “yep I should have known” and you get the point.

What can I do ? I don’t want to give up but also I don’t want to keep study and get too deep in the course when I can’t solve exercises and when I keep forgetting those things .

Thanks and sorry for the long rant I’m frustrated as hell

submitted by /u/Heyall1478
[link] [comments]

​r/learnpython Hey everyone . Almost 2 month ago I started pt penetrating online course . First , network fundamentals went great got 96 in the test. Then , Linux fundamentals again went great 98 in the test. Now Python..I feel like a stupid who can’t think properly . Learned about if, else, elife, list, and set . I understand the logic of everything I really do. And The basic behind it and what everything does. But when it comes to combine those things ? Like when I need to solve some exercise? I’m stupid as hell I swear it’s like my mind is going blank and I don’t even know where to start. Like I put the first input and then BOOM . Don’t know where to go and what to write . Keep forgetting things , even the small ones who can help me with exercises I can sit hours on reading the same things, I can practice and practice but still nothing when it comes to combining . I had up until now like 5 exercises, one I managed to solve alone , the rest i got frustrated and watch the teacher solve it . Something’s i say “yep we learned it why I didn’t think about it “ Sometimes “how the hell i should have known ?” And then after some times I’m like “yep I should have known” and you get the point. What can I do ? I don’t want to give up but also I don’t want to keep study and get too deep in the course when I can’t solve exercises and when I keep forgetting those things . Thanks and sorry for the long rant I’m frustrated as hell submitted by /u/Heyall1478 [link] [comments] 

Hey everyone . Almost 2 month ago I started pt penetrating online course .

First , network fundamentals went great got 96 in the test. Then , Linux fundamentals again went great 98 in the test.

Now Python..I feel like a stupid who can’t think properly . Learned about if, else, elife, list, and set . I understand the logic of everything I really do. And The basic behind it and what everything does.

But when it comes to combine those things ? Like when I need to solve some exercise? I’m stupid as hell I swear it’s like my mind is going blank and I don’t even know where to start. Like I put the first input and then BOOM . Don’t know where to go and what to write . Keep forgetting things , even the small ones who can help me with exercises

I can sit hours on reading the same things, I can practice and practice but still nothing when it comes to combining . I had up until now like 5 exercises, one I managed to solve alone , the rest i got frustrated and watch the teacher solve it . Something’s i say “yep we learned it why I didn’t think about it “ Sometimes “how the hell i should have known ?” And then after some times I’m like “yep I should have known” and you get the point.

What can I do ? I don’t want to give up but also I don’t want to keep study and get too deep in the course when I can’t solve exercises and when I keep forgetting those things .

Thanks and sorry for the long rant I’m frustrated as hell

submitted by /u/Heyall1478
[link] [comments]  Hey everyone . Almost 2 month ago I started pt penetrating online course . First , network fundamentals went great got 96 in the test. Then , Linux fundamentals again went great 98 in the test. Now Python..I feel like a stupid who can’t think properly . Learned about if, else, elife, list, and set . I understand the logic of everything I really do. And The basic behind it and what everything does. But when it comes to combine those things ? Like when I need to solve some exercise? I’m stupid as hell I swear it’s like my mind is going blank and I don’t even know where to start. Like I put the first input and then BOOM . Don’t know where to go and what to write . Keep forgetting things , even the small ones who can help me with exercises I can sit hours on reading the same things, I can practice and practice but still nothing when it comes to combining . I had up until now like 5 exercises, one I managed to solve alone , the rest i got frustrated and watch the teacher solve it . Something’s i say “yep we learned it why I didn’t think about it “ Sometimes “how the hell i should have known ?” And then after some times I’m like “yep I should have known” and you get the point. What can I do ? I don’t want to give up but also I don’t want to keep study and get too deep in the course when I can’t solve exercises and when I keep forgetting those things . Thanks and sorry for the long rant I’m frustrated as hell submitted by /u/Heyall1478 [link] [comments]

Read more

how to record a video from a webcam, with sound, from within python? /u/avsfjan Python Education

how to record a video from a webcam, with sound, from within python? /u/avsfjan Python Education

I am writing a python program for windows in which I want the user be able to quickly take a video from within the python app using the internal camera and microphone and then save the resulting video as an mp4, or similar.

The software needs to run on windows (specifically a surface tablet).

Obviously i googled first and found many, many tutorials on how to record video, but most of them without sound. Also all of them had the problem that the resulting video was badly synched and was timewarping around.

So far I tried CV2 and ffmpeg.

The latter via commandline and a separate ffmpeg.exe binary. This works in general, but has the same problem as all the CV2 solutions: audio and video are hardly in sync and the video speed is janky all over the video.

is there a better solution? Is this really this hard, or am i missing something here?

So far my code is this: (selecting cameras[1] and audio[0] is only specific to my test machine right now, this would later be dynamic…)

import subprocess import re import time list_devices = ['../ffmpeg.exe', '-list_devices', 'true', '-f', 'dshow', '-i', 'dummy'] result = subprocess.run( list_devices, # Arguments capture_output = True, # Python >= 3.7 only text = True # Python >= 3.7 only ) cameras = re.findall(""(.*)" (video)", result.stderr) audios = re.findall(""(.*)" (audio)", result.stderr) cam = cameras[1] audio = audios[0] record = ['../ffmpeg.exe', '-f', 'dshow', '-i', f"video={cam}:audio={audio}", '-vf', 'format=yuv420p', 'output.mp4'] recorder = subprocess.Popen(record, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, stdin=subprocess.PIPE) time.sleep(30) recorder.stdin.write('q') # Simulate user pressing q key recorder.communicate() recorder.wait() print('done') 

submitted by /u/avsfjan
[link] [comments]

​r/learnpython I am writing a python program for windows in which I want the user be able to quickly take a video from within the python app using the internal camera and microphone and then save the resulting video as an mp4, or similar. The software needs to run on windows (specifically a surface tablet). Obviously i googled first and found many, many tutorials on how to record video, but most of them without sound. Also all of them had the problem that the resulting video was badly synched and was timewarping around. So far I tried CV2 and ffmpeg. The latter via commandline and a separate ffmpeg.exe binary. This works in general, but has the same problem as all the CV2 solutions: audio and video are hardly in sync and the video speed is janky all over the video. is there a better solution? Is this really this hard, or am i missing something here? So far my code is this: (selecting cameras[1] and audio[0] is only specific to my test machine right now, this would later be dynamic…) import subprocess import re import time list_devices = [‘../ffmpeg.exe’, ‘-list_devices’, ‘true’, ‘-f’, ‘dshow’, ‘-i’, ‘dummy’] result = subprocess.run( list_devices, # Arguments capture_output = True, # Python >= 3.7 only text = True # Python >= 3.7 only ) cameras = re.findall(“”(.*)” (video)”, result.stderr) audios = re.findall(“”(.*)” (audio)”, result.stderr) cam = cameras[1] audio = audios[0] record = [‘../ffmpeg.exe’, ‘-f’, ‘dshow’, ‘-i’, f”video={cam}:audio={audio}”, ‘-vf’, ‘format=yuv420p’, ‘output.mp4’] recorder = subprocess.Popen(record, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, stdin=subprocess.PIPE) time.sleep(30) recorder.stdin.write(‘q’) # Simulate user pressing q key recorder.communicate() recorder.wait() print(‘done’) submitted by /u/avsfjan [link] [comments] 

I am writing a python program for windows in which I want the user be able to quickly take a video from within the python app using the internal camera and microphone and then save the resulting video as an mp4, or similar.

The software needs to run on windows (specifically a surface tablet).

Obviously i googled first and found many, many tutorials on how to record video, but most of them without sound. Also all of them had the problem that the resulting video was badly synched and was timewarping around.

So far I tried CV2 and ffmpeg.

The latter via commandline and a separate ffmpeg.exe binary. This works in general, but has the same problem as all the CV2 solutions: audio and video are hardly in sync and the video speed is janky all over the video.

is there a better solution? Is this really this hard, or am i missing something here?

So far my code is this: (selecting cameras[1] and audio[0] is only specific to my test machine right now, this would later be dynamic…)

import subprocess import re import time list_devices = ['../ffmpeg.exe', '-list_devices', 'true', '-f', 'dshow', '-i', 'dummy'] result = subprocess.run( list_devices, # Arguments capture_output = True, # Python >= 3.7 only text = True # Python >= 3.7 only ) cameras = re.findall(""(.*)" (video)", result.stderr) audios = re.findall(""(.*)" (audio)", result.stderr) cam = cameras[1] audio = audios[0] record = ['../ffmpeg.exe', '-f', 'dshow', '-i', f"video={cam}:audio={audio}", '-vf', 'format=yuv420p', 'output.mp4'] recorder = subprocess.Popen(record, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, stdin=subprocess.PIPE) time.sleep(30) recorder.stdin.write('q') # Simulate user pressing q key recorder.communicate() recorder.wait() print('done') 

submitted by /u/avsfjan
[link] [comments]  I am writing a python program for windows in which I want the user be able to quickly take a video from within the python app using the internal camera and microphone and then save the resulting video as an mp4, or similar. The software needs to run on windows (specifically a surface tablet). Obviously i googled first and found many, many tutorials on how to record video, but most of them without sound. Also all of them had the problem that the resulting video was badly synched and was timewarping around. So far I tried CV2 and ffmpeg. The latter via commandline and a separate ffmpeg.exe binary. This works in general, but has the same problem as all the CV2 solutions: audio and video are hardly in sync and the video speed is janky all over the video. is there a better solution? Is this really this hard, or am i missing something here? So far my code is this: (selecting cameras[1] and audio[0] is only specific to my test machine right now, this would later be dynamic…) import subprocess import re import time list_devices = [‘../ffmpeg.exe’, ‘-list_devices’, ‘true’, ‘-f’, ‘dshow’, ‘-i’, ‘dummy’] result = subprocess.run( list_devices, # Arguments capture_output = True, # Python >= 3.7 only text = True # Python >= 3.7 only ) cameras = re.findall(“”(.*)” (video)”, result.stderr) audios = re.findall(“”(.*)” (audio)”, result.stderr) cam = cameras[1] audio = audios[0] record = [‘../ffmpeg.exe’, ‘-f’, ‘dshow’, ‘-i’, f”video={cam}:audio={audio}”, ‘-vf’, ‘format=yuv420p’, ‘output.mp4’] recorder = subprocess.Popen(record, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, stdin=subprocess.PIPE) time.sleep(30) recorder.stdin.write(‘q’) # Simulate user pressing q key recorder.communicate() recorder.wait() print(‘done’) submitted by /u/avsfjan [link] [comments]

Read more

unittest word diff on strings /u/Informal-Addendum435 Python Education

unittest word diff on strings /u/Informal-Addendum435 Python Education

from unittest import TestCase class TestSomething(TestCase): def test_something(self): self.assertMultiLineEqual('one two three', 'one three three') 

produces the error message

AssertionError: 'one two three' != 'one three three' - one two three ? ^^ + one three three ? ^^^^ 

But I would find it more useful to see mismatches inline, like git --word-diff=color shows.

How can I use unittest and other libraries to do something like that?

submitted by /u/Informal-Addendum435
[link] [comments]

​r/learnpython from unittest import TestCase class TestSomething(TestCase): def test_something(self): self.assertMultiLineEqual(‘one two three’, ‘one three three’) produces the error message AssertionError: ‘one two three’ != ‘one three three’ – one two three ? ^^ + one three three ? ^^^^ But I would find it more useful to see mismatches inline, like git –word-diff=color shows. How can I use unittest and other libraries to do something like that? submitted by /u/Informal-Addendum435 [link] [comments] 

from unittest import TestCase class TestSomething(TestCase): def test_something(self): self.assertMultiLineEqual('one two three', 'one three three') 

produces the error message

AssertionError: 'one two three' != 'one three three' - one two three ? ^^ + one three three ? ^^^^ 

But I would find it more useful to see mismatches inline, like git --word-diff=color shows.

How can I use unittest and other libraries to do something like that?

submitted by /u/Informal-Addendum435
[link] [comments]  from unittest import TestCase class TestSomething(TestCase): def test_something(self): self.assertMultiLineEqual(‘one two three’, ‘one three three’) produces the error message AssertionError: ‘one two three’ != ‘one three three’ – one two three ? ^^ + one three three ? ^^^^ But I would find it more useful to see mismatches inline, like git –word-diff=color shows. How can I use unittest and other libraries to do something like that? submitted by /u/Informal-Addendum435 [link] [comments]

Read more

Struggling with parsing a list. /u/tuxon64 Python Education

Struggling with parsing a list. /u/tuxon64 Python Education

I’m accessing a smart energy monitoring plug for monthly usage. The output I get is a single element list like this.

json_str is [‘”== Emeter ==\n== For year 2024 ==\nMonth, usage (kWh)\n11, 11.72\n12, 21.292\n”‘]

I just need to extract the number after nXX, where XX will be 01 through 12 for the different months. In this case I need the 11.72 and the 21.292, so I can add them and get my total usage.

submitted by /u/tuxon64
[link] [comments]

​r/learnpython I’m accessing a smart energy monitoring plug for monthly usage. The output I get is a single element list like this. json_str is [‘”== Emeter ==\n== For year 2024 ==\nMonth, usage (kWh)\n11, 11.72\n12, 21.292\n”‘] I just need to extract the number after nXX, where XX will be 01 through 12 for the different months. In this case I need the 11.72 and the 21.292, so I can add them and get my total usage. submitted by /u/tuxon64 [link] [comments] 

I’m accessing a smart energy monitoring plug for monthly usage. The output I get is a single element list like this.

json_str is [‘”== Emeter ==\n== For year 2024 ==\nMonth, usage (kWh)\n11, 11.72\n12, 21.292\n”‘]

I just need to extract the number after nXX, where XX will be 01 through 12 for the different months. In this case I need the 11.72 and the 21.292, so I can add them and get my total usage.

submitted by /u/tuxon64
[link] [comments]  I’m accessing a smart energy monitoring plug for monthly usage. The output I get is a single element list like this. json_str is [‘”== Emeter ==\n== For year 2024 ==\nMonth, usage (kWh)\n11, 11.72\n12, 21.292\n”‘] I just need to extract the number after nXX, where XX will be 01 through 12 for the different months. In this case I need the 11.72 and the 21.292, so I can add them and get my total usage. submitted by /u/tuxon64 [link] [comments]

Read more

I need help finding a python IDE /u/Own-Recipe5931 Python Education

I need help finding a python IDE /u/Own-Recipe5931 Python Education

I had been using replit for school

but now replit is limited so I’ve been having problems with the IDE

Please could you tell me a python IDE which dosen’t needs to be downloaded on the computer(because it’s banned) so i need a IDE which allows me to create loads of python files and save them which also runs online instead of having to download it

submitted by /u/Own-Recipe5931
[link] [comments]

​r/learnpython I had been using replit for school but now replit is limited so I’ve been having problems with the IDE Please could you tell me a python IDE which dosen’t needs to be downloaded on the computer(because it’s banned) so i need a IDE which allows me to create loads of python files and save them which also runs online instead of having to download it submitted by /u/Own-Recipe5931 [link] [comments] 

I had been using replit for school

but now replit is limited so I’ve been having problems with the IDE

Please could you tell me a python IDE which dosen’t needs to be downloaded on the computer(because it’s banned) so i need a IDE which allows me to create loads of python files and save them which also runs online instead of having to download it

submitted by /u/Own-Recipe5931
[link] [comments]  I had been using replit for school but now replit is limited so I’ve been having problems with the IDE Please could you tell me a python IDE which dosen’t needs to be downloaded on the computer(because it’s banned) so i need a IDE which allows me to create loads of python files and save them which also runs online instead of having to download it submitted by /u/Own-Recipe5931 [link] [comments]

Read more

I am trying to get a option to put in a answer in my code that gives a diffrent output based on which if else statement is true. Why wont it work? /u/Future_SFT_ENG Python Education

I am trying to get a option to put in a answer in my code that gives a diffrent output based on which if else statement is true. Why wont it work? /u/Future_SFT_ENG Python Education

I’m beginner in coding and was practicing by myself. below is the code i wrote.

 print("the result of the operation is", sum) input_answer=input ("give the correct answer to see if you are worthy: ") magic=1000000000 skill_level=0 sum= magic*skill_level print(sum) if sum< 1: print("you are not worthy") else: print("You are worthy") 

submitted by /u/Future_SFT_ENG
[link] [comments]

​r/learnpython I’m beginner in coding and was practicing by myself. below is the code i wrote. print(“the result of the operation is”, sum) input_answer=input (“give the correct answer to see if you are worthy: “) magic=1000000000 skill_level=0 sum= magic*skill_level print(sum) if sum< 1: print(“you are not worthy”) else: print(“You are worthy”) submitted by /u/Future_SFT_ENG [link] [comments] 

I’m beginner in coding and was practicing by myself. below is the code i wrote.

 print("the result of the operation is", sum) input_answer=input ("give the correct answer to see if you are worthy: ") magic=1000000000 skill_level=0 sum= magic*skill_level print(sum) if sum< 1: print("you are not worthy") else: print("You are worthy") 

submitted by /u/Future_SFT_ENG
[link] [comments]  I’m beginner in coding and was practicing by myself. below is the code i wrote. print(“the result of the operation is”, sum) input_answer=input (“give the correct answer to see if you are worthy: “) magic=1000000000 skill_level=0 sum= magic*skill_level print(sum) if sum< 1: print(“you are not worthy”) else: print(“You are worthy”) submitted by /u/Future_SFT_ENG [link] [comments]

Read more

User and Password Interface Pt. 2 /u/Take-The-L-Train Python Education

User and Password Interface Pt. 2 /u/Take-The-L-Train Python Education

This is a continuation of a post I made earlier. I think I have a better grasp of while loops and if/else statements, but there are still a few kinks in my code.

The code is:

  1. print(‘Welcome to the USG Ishimura.’) 2.
  2. user = input(‘Please enter your user ID: ‘)
  3. print(‘Welcome, ‘ , user) 5.
  4. while True:
  5. x = input(‘Please enter your passcode: ‘)
  6. if x == ‘987413’:
  7. if user == ‘Isaac Clarke’:
  8. print(‘Access granted.’)
  9. break
  10. else:
  11. print(‘Access denied. Please try again.’)
  12. if x == ‘987319’:
  13. if user == ‘Zachary Hammond’:
  14. print(‘Access granted.’)
  15. break
  16. else:
  17. print(‘Access denied. Please try again.’)
  18. if x == ‘987665’:
  19. if user == ‘Kendra Daniels’:
  20. print(‘Access granted.’)
  21. break
  22. else:
  23. print(‘Access denied. Please try again.’)

Everything’s working the way that I want it to, but when I put in Zachary Hammond or Kendra Daniels’ username and passcode, the terminal will print out ‘Access denied. Please try again.’ as well as ‘Access granted.’ Basically, both the if and the else statement are printing out at the same time. How can I correct this so only the if or the else statement will print out at once?

submitted by /u/Take-The-L-Train
[link] [comments]

​r/learnpython This is a continuation of a post I made earlier. I think I have a better grasp of while loops and if/else statements, but there are still a few kinks in my code. The code is: print(‘Welcome to the USG Ishimura.’) 2. user = input(‘Please enter your user ID: ‘) print(‘Welcome, ‘ , user) 5. while True: x = input(‘Please enter your passcode: ‘) if x == ‘987413’: if user == ‘Isaac Clarke’: print(‘Access granted.’) break else: print(‘Access denied. Please try again.’) if x == ‘987319’: if user == ‘Zachary Hammond’: print(‘Access granted.’) break else: print(‘Access denied. Please try again.’) if x == ‘987665’: if user == ‘Kendra Daniels’: print(‘Access granted.’) break else: print(‘Access denied. Please try again.’) Everything’s working the way that I want it to, but when I put in Zachary Hammond or Kendra Daniels’ username and passcode, the terminal will print out ‘Access denied. Please try again.’ as well as ‘Access granted.’ Basically, both the if and the else statement are printing out at the same time. How can I correct this so only the if or the else statement will print out at once? submitted by /u/Take-The-L-Train [link] [comments] 

This is a continuation of a post I made earlier. I think I have a better grasp of while loops and if/else statements, but there are still a few kinks in my code.

The code is:

  1. print(‘Welcome to the USG Ishimura.’) 2.
  2. user = input(‘Please enter your user ID: ‘)
  3. print(‘Welcome, ‘ , user) 5.
  4. while True:
  5. x = input(‘Please enter your passcode: ‘)
  6. if x == ‘987413’:
  7. if user == ‘Isaac Clarke’:
  8. print(‘Access granted.’)
  9. break
  10. else:
  11. print(‘Access denied. Please try again.’)
  12. if x == ‘987319’:
  13. if user == ‘Zachary Hammond’:
  14. print(‘Access granted.’)
  15. break
  16. else:
  17. print(‘Access denied. Please try again.’)
  18. if x == ‘987665’:
  19. if user == ‘Kendra Daniels’:
  20. print(‘Access granted.’)
  21. break
  22. else:
  23. print(‘Access denied. Please try again.’)

Everything’s working the way that I want it to, but when I put in Zachary Hammond or Kendra Daniels’ username and passcode, the terminal will print out ‘Access denied. Please try again.’ as well as ‘Access granted.’ Basically, both the if and the else statement are printing out at the same time. How can I correct this so only the if or the else statement will print out at once?

submitted by /u/Take-The-L-Train
[link] [comments]  This is a continuation of a post I made earlier. I think I have a better grasp of while loops and if/else statements, but there are still a few kinks in my code. The code is: print(‘Welcome to the USG Ishimura.’) 2. user = input(‘Please enter your user ID: ‘) print(‘Welcome, ‘ , user) 5. while True: x = input(‘Please enter your passcode: ‘) if x == ‘987413’: if user == ‘Isaac Clarke’: print(‘Access granted.’) break else: print(‘Access denied. Please try again.’) if x == ‘987319’: if user == ‘Zachary Hammond’: print(‘Access granted.’) break else: print(‘Access denied. Please try again.’) if x == ‘987665’: if user == ‘Kendra Daniels’: print(‘Access granted.’) break else: print(‘Access denied. Please try again.’) Everything’s working the way that I want it to, but when I put in Zachary Hammond or Kendra Daniels’ username and passcode, the terminal will print out ‘Access denied. Please try again.’ as well as ‘Access granted.’ Basically, both the if and the else statement are printing out at the same time. How can I correct this so only the if or the else statement will print out at once? submitted by /u/Take-The-L-Train [link] [comments]

Read more