info102lab1questions

pdf

School

University of Illinois, Urbana Champaign *

*We aren’t endorsed by this school

Course

102

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

1

Uploaded by PrivateBraveryFrog26

Report
Discussion 1. What does the "^" operator do in Python? What about the "|" operator? Based on your answers, can you guess what the "&" operator does? The OR operator in Python, denoted by "^" assesses whether any of the bits within the given values are set to 1. On the other hand, the XOR operator, represented by "|" examines whether exactly one bit is set to 1. From these insights, it can be inferred that the "&" operator determines whether both bits are set to 1. 2. What do the "<<" and ">>" operators do in Python? Can you describe the operations in mathematical terms? The "<<" and “>>” operators in Python function as shifters, manipulating bits by shifting them to the left or right. In mathematical terms, this operation entails either multiplication or division by a factor. Shifting left corresponds to multiplication while shifting right corresponds to division. 3. What do the "/", "//" and "%" operators do in Python? What's the difference between "/" and "//"? The “/" operator functions as a basic division operator, dividing two numbers as expected. Conversely, the “//" operator also divides numbers but rounds the result to the nearest whole number, disregarding any remainder if the division is not exact. Meanwhile, the "%" operator yields the remainder after the division. 4. Could you decode the message? I did not decode the message
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help